Environment Variables & Config (.env, YAML)
What config files really do, why settings live outside your code, how environment variables and .env files work, and how YAML/JSON/TOML and config precedence fit together.
Download EPUB- Why Config Lives Outside Code The same application runs in development, staging, and production with different settings; configuration is the layer that separates what changes per environment from the code, so you ship one codebase everywhere.
- Environment Variables & .env Files An environment variable is a name=value pair the operating system hands your process; here's how to read one from the shell and from code, and how .env files load them for local development - plus why you must never commit a .env file.
- Config Files: YAML & Friends When config grows past a few values you reach for structured files - YAML, JSON, or TOML; here's how YAML works, the indentation trap that bites everyone, and the precedence order (defaults < file < environment variable) that decides which setting wins.