buzz
buzz copied to clipboard
fix(admin): fail loudly when DATABASE_URL is unset instead of falling back to dev credentials
Summary
- replace
unwrap_or_else(|_| "postgres://buzz:buzz_dev@localhost:5432/buzz")inconnect_db()withstd::env::var("DATABASE_URL").context(...)? - add
Contextto theanyhowimport - add regression test spawning
buzz-admin migratewithDATABASE_URLunset
Why
buzz-admin silently substituted hardcoded dev credentials when
DATABASE_URL was missing, masking a missing-config problem as a
misleading password authentication failed for user "buzz" error on
deployments with hardened credentials. Failing loudly surfaces the real
problem and points the operator at .env.
The relay doesn't load .env internally either — both binaries rely on
just's set dotenv-load := true. Failing hard makes buzz-admin
consistent with the relay's behavior (no silent fallback) rather than
introducing a new inconsistency.
Test plan
cargo fmt -p buzz-admin -- --checkcargo test -p buzz-admin --test db_url_unset(1 passed)cargo clippy -p buzz-admin --all-targets -- -D warningsgit diff --check
Closes #2837