300-910 · Question #104
An application development project has these requirements: deployment via a container image image building as part of a CI/CD pipeline test in dev and stage environments How must the development team
The correct answer is C. Store the configuration in environment variables.. According to the Twelve-Factor App methodology, configuration that varies between deployments (like dev and stage environments) should be stored in environment variables to keep it separate from the codebase.
Question
- deployment via a container image
- image building as part of a CI/CD pipeline
- test in dev and stage environments
Exhibit
Options
- AUse the configuration in files that are not checked into revision control.
- BStore the configuration as constants in the code.
- CStore the configuration in environment variables.
- DBatch the configuration into named groups (dev, stage, prod).
How the community answered
(46 responses)- A4% (2)
- B2% (1)
- C91% (42)
- D2% (1)
Why each option
According to the Twelve-Factor App methodology, configuration that varies between deployments (like dev and stage environments) should be stored in environment variables to keep it separate from the codebase.
Storing configuration in files not checked into revision control can lead to inconsistencies, make deployments less reproducible, and complicate audits, contradicting principles of consistent and manageable deployments.
Storing configuration as constants in the code tightly couples the configuration to the application, requiring code changes and a new build for every configuration modification across environments, which is against the Twelve-Factor App principles.
The Twelve-Factor App methodology mandates that configuration, which includes anything that varies between deployments (e.g., database credentials, external service handles), should be strictly separated from the code. Storing configuration in environment variables ensures that the same code base can be deployed across multiple environments (development, staging, production) with different configurations, without code changes or recompilation, aligning with principles for containerized deployments and CI/CD.
While configuration might logically exist for different environments (dev, stage, prod), the Twelve-Factor App specifies *how* that configuration should be exposed to the application, advocating environment variables rather than specific file structures or grouping mechanisms within the codebase.
Concept tested: Twelve-Factor App - config management (Env Vars)
Source: https://12factor.net/config
Topics
Community Discussion
No community discussion yet for this question.
