Environment variables & secrets
Fill-gap25 min
Environment variables & secrets
Code is public-ish; configuration is not. Secrets live in the environment:
export DB_PASSWORD=…
export JWT_ACCESS_SECRET=…Two iron rules:
- `.env` never enters git — it is ignored (see this repo's
.gitignore),
and .env.example documents the shape without the values.
- Every secret is replaceable. If it leaked, rotate it — a secret you
cannot rotate is an outage waiting for its moment.
This app validates its environment at boot (config/env.validation.ts): if JWT_ACCESS_SECRET is missing, the server refuses to start. Fail fast, on purpose.
Exercise
List every environment variable this app's backend reads. For each: is it a secret, a URL, or a toggle? Where does CI provide it?