# Environment Config

Configuration discipline that keeps environments honest.

## Rules

1. **Config in environment variables, not in files.** `.env` files are for local development. Production config comes from the environment. If your app can't start without a config file, it's coupled to the filesystem.

2. **Fail fast on missing config.** If `DATABASE_URL` is required and missing, crash immediately on startup. Don't default to localhost. Don't log a warning and continue. The app is misconfigured — stop it.

3. **Typed config, not stringly-typed.** Parse environment variables into their correct types at startup. Port is an integer. Feature flags are booleans. URLs are parsed and validated. Store them in a config object, not in `process.env` lookups scattered through the code.

4. **No environment-specific code paths.** `if (process.env.NODE_ENV === 'production')` is a code smell. The same code runs everywhere. Config differs. Behavior differs through config, not through branching.

5. **Secrets and config are separate concerns.** Config is version-controlled, reviewed, and auditable. Secrets are in secret managers, rotated, and never logged. Don't mix them.

6. **Defaults are for development only.** Production must be explicit. If a value has a default, it's a development convenience. Production deployments must provide every required value.

## What This Replaces

Config files checked into source control and environment-dependent code paths. Configuration becomes a clean, typed, validated object that the application trusts.
