Why externalize configuration
On This Lesson 4 topics
The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.
In this lesson
keep settings out of the code.
Planned topics
- Configuration is anything that changes between places: database address, tax rate, API key.
- If it is in the code, you must rebuild to change it.
- The twelve-factor rule: separate config from code.
- Build the JAR once, run it anywhere with different settings.
- Do not write
if (env.equals("prod"))in code.
Draft outline details
Demonstration
a hard-coded String url = "jdbc:...prod..." replaced by config.get("db.url").
Check your understanding
What does twelve-factor say about config?
Show answer
Keep it separate from code.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.