Update provisioning.ts
CI / ci (push) Canceled after 0s

This commit is contained in:
Stefan Lazic committed 2026-09-05 17:14:39 +01:00
1 parent 3b07124d7e
commit 2e739c9a26
1 file changed
+14 -1
+14 -1
View File
@@ -188,7 +188,20 @@ export async function updateBusiness(input: UpdateBusinessInput): Promise<Update
const dir = stackDir(slug); const dir = stackDir(slug);
const envPath = path.join(dir, ".env"); const envPath = path.join(dir, ".env");
const currentEnv = await readEnvFile(envPath); const currentEnv = await readEnvFile(envPath);
const currentDomain = currentEnv ? readEnvValue(currentEnv, "DOMAIN") : null; if (currentEnv === null) {
// stackExists() above only confirms compose.yaml is there — a stack
// can have that without ever having been through real provisioning
// (e.g. a hand-written example stack that was never actually started
// with a real database). Editing one would otherwise silently write
// a stub .env containing only the 4 keys below, missing
// DATABASE_HOST/NAME/USER/PASSWORD, AUTH_SECRET, etc. entirely —
// this happened for real once, see the fix commit for this line.
throw new Error(
`"${slug}" has no existing configuration to edit — it was never fully provisioned with a database. ` +
"Remove its stack directory and use Add Business instead, or complete its setup by hand first (see stacks/infra/compose.yaml's header).",
);
}
const currentDomain = readEnvValue(currentEnv, "DOMAIN");
const domainChanged = currentDomain !== domain; const domainChanged = currentDomain !== domain;
// Only these four keys are ever touched — everything else in the file // Only these four keys are ever touched — everything else in the file