CI / Lint (push) Successful in 3m4s
CI / Typecheck (push) Successful in 3m6s
CI / Architecture Guardrails (push) Successful in 3m8s
CI / Assistant Split Regression (push) Successful in 3m48s
CI / Build (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 3): compose/DB/infra + stray code refs capakraken → nexus (#62) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
35 lines
930 B
TypeScript
35 lines
930 B
TypeScript
import {
|
|
assertDestructiveDbAllowed,
|
|
formatTarget,
|
|
parseDatabaseUrl,
|
|
} from "./destructive-db-guard.js";
|
|
|
|
const TEST_DATABASE_NAMES = ["nexus_test", "nexus_e2e", "nexus_ci"];
|
|
|
|
export function assertSafeSeedTarget(commandName: string) {
|
|
return assertDestructiveDbAllowed({
|
|
commandName,
|
|
allowedDatabaseNames: TEST_DATABASE_NAMES,
|
|
});
|
|
}
|
|
|
|
export function assertNexusDbTarget(commandName: string) {
|
|
const rawUrl = process.env.DATABASE_URL;
|
|
|
|
if (!rawUrl) {
|
|
throw new Error(
|
|
`${commandName} aborted: DATABASE_URL is not configured. Run the command through the Nexus env wrappers so the workspace env files are loaded.`,
|
|
);
|
|
}
|
|
|
|
const target = parseDatabaseUrl(rawUrl);
|
|
|
|
if (!target.databaseName.startsWith("nexus")) {
|
|
throw new Error(
|
|
`${commandName} aborted: database '${target.databaseName}' is not a valid Nexus target. Target=${formatTarget(target)}`,
|
|
);
|
|
}
|
|
|
|
return target;
|
|
}
|