mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
fix cli for cloudflare proxy and plugins
- proper cli exists required for cloudflare proxy to dispose - updated cloudflare proxy to allow proxy options (e.g. remote) - updated config command to include proper required structure for the export on code mode
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { App, type AppConfig, type AppPlugin } from "bknd";
|
||||
import { App, type AppConfig, type AppPlugin, type MaybePromise, type ModuleConfigs } from "bknd";
|
||||
|
||||
export type SyncConfigOptions = {
|
||||
enabled?: boolean;
|
||||
includeSecrets?: boolean;
|
||||
includeFirstBoot?: boolean;
|
||||
write: (config: AppConfig) => Promise<void>;
|
||||
write: (config: ModuleConfigs) => MaybePromise<void>;
|
||||
};
|
||||
|
||||
export function syncConfig({
|
||||
@@ -14,6 +14,14 @@ export function syncConfig({
|
||||
write,
|
||||
}: SyncConfigOptions): AppPlugin {
|
||||
let firstBoot = true;
|
||||
|
||||
const getConfigs = (app: App, secrets = false) => {
|
||||
if (secrets) {
|
||||
return app.toJSON(true);
|
||||
}
|
||||
return app.modules.extractSecrets().configs;
|
||||
};
|
||||
|
||||
return (app: App) => ({
|
||||
name: "bknd-sync-config",
|
||||
onBuilt: async () => {
|
||||
@@ -21,7 +29,7 @@ export function syncConfig({
|
||||
app.emgr.onEvent(
|
||||
App.Events.AppConfigUpdatedEvent,
|
||||
async () => {
|
||||
await write?.(app.toJSON(includeSecrets));
|
||||
await write?.(getConfigs(app, includeSecrets));
|
||||
},
|
||||
{
|
||||
id: "sync-config",
|
||||
@@ -30,7 +38,7 @@ export function syncConfig({
|
||||
|
||||
if (firstBoot && includeFirstBoot) {
|
||||
firstBoot = false;
|
||||
await write?.(app.toJSON(includeSecrets));
|
||||
await write?.(getConfigs(app, includeSecrets));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user