</>CodexBash
All articles
DevOps

Environment variables and the twelve-factor app

How environment variables work and why the twelve-factor methodology stores configuration in them: setting and reading variables on Linux, macOS and Windows, .env files, reading config in Java, Python and Node.js, validation at start-up, the twelve factors summarised, and where environment variables fall short.

CodexBash, , 5 min read

The same application usually runs in several places: your laptop, a CI pipeline, a staging server and production. Each needs different database addresses, API keys and settings, yet the code should be identical everywhere. Environment variables are the most common way to supply those differences, and the twelve-factor app, a methodology published by engineers at Heroku, made "store config in the environment" a widely followed rule. This article explains how environment variables work, how to use them well in code, and summarises all twelve factors.

Sign in to read the rest

The whole 5 minute article is free with an account, along with every problem, lesson and tutorial. No card.