Repaso
Español
Cloud & DevOpsIntermediateOPS-17

According to the Twelve-Factor App, where should configuration that varies between environments live?

Options

  1. In hardcoded constants inside the source code
  2. In environment variables, kept outside the code (Correct option)
  3. In a shared spreadsheet that the whole team edits
  4. Inside the Docker image, baked in at build time

Answer

Environment variables (or injected config), not in the code

Why

The same code runs in development, staging and production; only settings differ (database URL, API keys, debug mode).

Keeping those settings in environment variables means you build the image once and run it anywhere with different config, and secrets never land in the code.

The Twelve-Factor App is a well-known checklist for cloud-friendly apps (also: stateless processes, logs to stdout).

Remember

Config that changes per environment → environment variables.

Key terms

Practice this question in Repaso