Configuration version control
Treat configuration as a reviewed release
Configuration as code means storing the desired server configuration in a versioned, reviewable form. A commit describes a change; it does not prove that the server is using it. In this example a release consists of an entry configuration, included files, input values, the exact runtime identity and tests. Keep the staging and production inputs separate while promoting the same reviewed artifact. A branch alone is not an environment. Record the approved commit and artifact digest in the deployment record.
config/ nginx.conf routes/catalog.confinputs/ lab.jsontests/ expected-responses.jsonrelease-manifest.jsonReview the effective routing change
This diff is an illustration of a route change inside a server block. The old backend listens on 19081 and the proposed one on 19082. Neither port identifies a live backend in the offline lab. A reviewer must establish that the new backend exists, is authorized, speaks the expected protocol and has the same path contract. Review the referenced file and its inclusion context, not only the top-level file. Inspect the diff against the last deployed commit; a change to an included file is a real configuration change even if nginx.conf is unchanged.
location /catalog/ {- proxy_pass http://127.0.0.1:19081/;+ proxy_pass http://127.0.0.1:19082/; }Render only constrained inputs
The lab renderer maps a symbolic release name to a trusted literal marker. It rejects every other name before producing configuration. A template is a programmatic way to generate text, not an Nginx directive. HTML escaping does not make arbitrary text safe in Nginx syntax. Do not interpolate a user-supplied path, directive or arbitrary host into a privileged configuration. Keep template files trusted; validate input types, ranges and membership. The included Python snippet is a complete pure function plus a call; the output is release-b.
def marker(release): allowed = {"a": "release-a", "b": "release-b"} if release not in allowed: raise ValueError("unknown release") return allowed[release]
print(marker("b"))Separate secrets and record provenance
A release record may identify the certificate mount without containing the key. Private keys, tokens and sensitive rendered values belong in a restricted secret-delivery system. Do not commit them, include them in an image layer or upload an expanded configuration containing secrets. Use an artifact checksum to identify bytes and protected approval evidence to establish provenance; a checksum alone does not establish trust. The JSON below is an illustrative release record, not a credential or real digest. In the lab a real hash is calculated from generated bytes.
{ "release": "b", "artifact": "nginx.conf", "certificateRef": "lab-certificate-mount", "approval": "required"}Apply what you learned
Practice: A proposed change modifies an included upstream file and adds a private key to Git. Identify what must be blocked and describe the release evidence you require. The manual exercise and quiz are staged separately. Related references and the next lesson are listed in the chapter authored map.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Configuration version control
Assess configuration release and verification reasoning.
What does a Git commit prove?
Why review included files?
Which template input is safest for this lab?
Where should private keys be kept?
What does a checksum establish by itself?