feat(F-004): typed fail-fast config and feature flag module
- loadConfig: pure over env object, accumulates all problems, names var names only - DATABASE_URL now required at startup; PORT/HOST/LOG_LEVEL/NODE_ENV/REDIS_URL defaulted - flags module behind FeatureFlagProvider; unknown flags OFF; runtime setEnabled (no redeploy) - buildApp decorates app.flags; server.ts fail-fast before app boot - tests caught and fixed flag-store case-normalization bug before gates - zero new dependencies; all gates approved; verify.sh green
This commit is contained in:
@@ -19,6 +19,17 @@ npm run lint # eslint + prettier check
|
||||
npm run lint:boundaries # module boundary check
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Startup is fail-fast: `src/infrastructure/config` parses env once and refuses to boot
|
||||
on missing/invalid required vars. `DATABASE_URL` is required; `PORT`, `HOST`,
|
||||
`LOG_LEVEL`, `NODE_ENV`, `REDIS_URL` are optional with defaults. Errors name variable
|
||||
NAMES only, never values.
|
||||
|
||||
Feature flags: `FLAG_<NAME>=true|false` env vars seed the flag store at boot. Unknown
|
||||
flags default to OFF (fail-safe). Flags flip at runtime through the store — activation
|
||||
is separate from deployment (no redeploy). Copy `.env.example` to `.env` to start.
|
||||
|
||||
## HTTP contract
|
||||
|
||||
- Every response carries an `x-request-id` header (propagated from a safe incoming
|
||||
|
||||
Reference in New Issue
Block a user