Part 10 / Topic 1 of 6
Configuration from the environment
The service you built in Part 9 must run in three places — your laptop, Acme's staging, Acme's production — without three codebases. The rule (from the twelve-factor playbook): one build, many environments; everything that differs comes from the environment:
url = os.environ["ACME_API_URL"] # differs per environment
token = os.environ["ACME_API_TOKEN"] # secret, injected at runtime
What belongs in config: URLs, credentials, page sizes, log levels, feature switches. What does not: anything identical everywhere (that is just code) and anything the customer must not change (that is a constant). If you find an if environment == "prod" branch in application logic, a config value is trying to get out.
Done here? The practice set for Part 10 — 4 exercises with solutions — is on the part page.