fix(config): decouple dotenv load from parsing so defaults test is deterministic (BUNYIP-102) #236
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bunyip-102-config-dotenv-decouple"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Config::from_env() loaded a repo-root .env via dotenvy::dotenv() as part of
parsing, so test_config_defaults could not control its process env: a developer
.env setting RUST_LOG=info,bunyip_api=debug (and the other vars the test clears)
was re-injected and clobbered the asserted code defaults. The test passed in CI
(clean checkout) but failed on any dev box with a populated .env, including
inside just check-container.
Split from_env() into the dotenvy load plus a pure from_env_inner() that reads
only the current process env. Production from_env() still loads .env. The test
now removes the relevant vars and calls from_env_inner(), so a repo-root .env
can no longer re-inject values mid-test.
#BUNYIP-102