1 file changed
+14
-1
@@ -188,7 +188,20 @@ export async function updateBusiness(input: UpdateBusinessInput): Promise<Update
|
||||
const dir = stackDir(slug);
|
||||
const envPath = path.join(dir, ".env");
|
||||
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;
|
||||
|
||||
// Only these four keys are ever touched — everything else in the file
|
||||
|
||||
Reference in new issue
Block a user