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:
dswbx
2025-09-16 16:08:01 +02:00
parent a0b2dde034
commit 317b2b50ad
12 changed files with 241 additions and 43 deletions

View File

@@ -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));
}
},
});