350-901 · Question #53
Application sometimes store configuration as constants in the code, which is a violation of strict separation of configuration from code. Where should application configuration be stored?
The correct answer is A. environment variables. The 12-Factor App methodology mandates storing configuration in environment variables to achieve strict separation of config from code and enable portability across environments.
Question
Options
- Aenvironment variables
- BYAML files
- CPython libraries
- DDockerfiles
- EINI files
How the community answered
(23 responses)- A87% (20)
- D9% (2)
- E4% (1)
Why each option
The 12-Factor App methodology mandates storing configuration in environment variables to achieve strict separation of config from code and enable portability across environments.
Environment variables are the standard 12-Factor App method for externalizing configuration because they are language- and OS-agnostic, cannot be accidentally committed to source control, and can be changed per deployment environment without modifying code.
YAML files can still be bundled with the application codebase, making them susceptible to accidental commit and not achieving strict separation from code.
Python libraries are code artifacts and embedding configuration in them directly violates the separation-of-config-from-code principle.
Dockerfiles are part of the build artifact and are committed to source control, making them an inappropriate place for environment-specific configuration.
INI files suffer the same problem as YAML files - they are typically stored alongside the codebase and do not enforce strict separation.
Concept tested: 12-Factor App config stored in environment variables
Source: https://12factor.net/config
Topics
Community Discussion
No community discussion yet for this question.