fix: add E2E opt-out for fail-loud secret/DB-URL guards
Playwright runs the server via `react-router serve` with
NODE_ENV=production but against a local dev Postgres and local cookie
secrets. The guards added in 5a7bb76 refused to start under that
configuration. `E2E=true` (already set by the CI E2E job) is now the
explicit opt-out: in real production this env var is never set, so the
guard still bites.
This commit is contained in:
parent
9d48d26a6e
commit
ebedfa257b
3 changed files with 13 additions and 8 deletions
|
|
@ -15,7 +15,11 @@ const DEV_DB_URL = "postgres://trails:trails@localhost:5432/trails";
|
|||
export function getDatabaseUrl(override?: string): string {
|
||||
if (override) return override;
|
||||
const url = process.env.DATABASE_URL;
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
// Playwright runs `react-router serve` which boots with
|
||||
// NODE_ENV=production, but the CI E2E suite legitimately points at a
|
||||
// local Postgres using the dev URL. E2E=true is the explicit opt-out.
|
||||
const isProd = process.env.NODE_ENV === "production" && process.env.E2E !== "true";
|
||||
if (isProd) {
|
||||
if (!url || url === DEV_DB_URL) {
|
||||
throw new Error(
|
||||
"Refusing to start: DATABASE_URL is unset or matches the dev default. " +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue