Why this matters
Ensures consistency and surfaces misconfiguration early.
Load and validate environment/config once during startup; inject settings into modules instead of re-reading env.
Ensures consistency and surfaces misconfiguration early.
Side-by-side examples engineers can pattern-match during review.
def handler():
url = os.getenv('SERVICE_URL')
...class Settings(TypedDict):
SERVICE_URL: str
SETTINGS: Settings = load_and_validate_env()
def handler(settings: Settings = SETTINGS):
...os.getenv('X') everywhereSETTINGS = load_env(); use SETTINGSFrom the same buckets as this rule.