← DevOps Foundations
11 / 25
Lesson 11 — Config merge
Layers of settings
Real apps combine settings from several layers: built-in defaults, then a config file, then environment variables. Later layers win. The spread syntax { ...a, ...b } copies a and then b into a new object, so keys in b overwrite keys in a.
{ ...{ port: 3000 }, ...{ port: 8080 } } // { port: 8080 }
Why it matters: missing keys fall back safely, and you can always override one setting without copying the rest.
Want it another way?
Task
Merge defaults, then file, then env (env wins), and log each final setting.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
Test your knowledge
A quick 3-question quiz on this lesson — instant feedback.