From 3c5e3f96389e51718c576e97f7a88ad716ed53b7 Mon Sep 17 00:00:00 2001 From: dswbx Date: Fri, 5 Sep 2025 14:14:12 +0200 Subject: [PATCH] manager: fix secrets extraction for both modes --- app/package.json | 2 +- app/src/modules/ModuleManager.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/package.json b/app/package.json index c398fa5..cdc14fc 100644 --- a/app/package.json +++ b/app/package.json @@ -3,7 +3,7 @@ "type": "module", "sideEffects": false, "bin": "./dist/cli/index.js", - "version": "0.17.1", + "version": "0.18.0-rc.1", "description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.", "homepage": "https://bknd.io", "repository": { diff --git a/app/src/modules/ModuleManager.ts b/app/src/modules/ModuleManager.ts index aeebf8c..ffb581d 100644 --- a/app/src/modules/ModuleManager.ts +++ b/app/src/modules/ModuleManager.ts @@ -210,7 +210,7 @@ export class ModuleManager { extractSecrets() { const moduleConfigs = structuredClone(this.configs()); - const secrets = this.options?.secrets || ({} as any); + const secrets = { ...this.options?.secrets }; const extractedKeys: string[] = []; for (const [key, module] of Object.entries(this.modules)) { @@ -221,11 +221,10 @@ export class ModuleManager { (n) => n.schema instanceof SecretSchema, ); - //console.log("extracted", key, extracted, config); for (const n of extracted) { const path = [key, ...n.instancePath].join("."); - if (typeof n.data === "string" && n.data.length > 0) { + if (typeof n.data === "string") { extractedKeys.push(path); secrets[path] = n.data; setPath(moduleConfigs, path, ""); @@ -264,11 +263,11 @@ export class ModuleManager { // if secrets were provided, extract, merge and build again const provided_secrets = this.options?.secrets ?? {}; if (Object.keys(provided_secrets).length > 0) { - const { configs, secrets, extractedKeys } = this.extractSecrets(); + const { configs, extractedKeys } = this.extractSecrets(); for (const key of extractedKeys) { if (key in provided_secrets) { - setPath(configs, key, secrets[key]); + setPath(configs, key, provided_secrets[key]); } }