Env Variables
Question
Why use environment variables for configuration?
Hint
Env vars follow 12-factor app principles.
Explanation
Environment variables separate configuration from code, following the 12-factor app methodology. Benefits: 1) Same code for all environments (dev/staging/prod). 2) No secrets in code. 3) Easy to change without rebuilding. 4) Language/framework agnostic. 5) Easy to override in containers/CI. Access: process.env.NAME (Node.js), os.environ (Python), System.getenv (Java). In Docker: docker run -e NAME=value. In K8s: env in Pod spec, ConfigMap, Secret. Never commit .env files to Git. Use .env.example as documentation. Tools: dotenv (load from file), Doppler (manage secrets).
Related Resources
Related Lessons
- Env Variables
Learn env vars.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.