feat(client): add STATION_CODE env var and config attribute

Reads STATION_CODE from the environment and exposes it as Config.STATION_CODE
(None when unset or empty). Adds the variable to .env.example with a
per-station deployment note, and covers both read and missing-key paths with
new pytest tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 23:18:24 +02:00
parent 2e4db53f6a
commit 958f6ac0b0
3 changed files with 25 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
"""Tests that STATION_CODE is loaded from env and exposed on the client Config class."""
import importlib
import os
def test_station_code_read_from_env(monkeypatch):
monkeypatch.setenv("STATION_CODE", "ST-TEST")
import config
importlib.reload(config)
assert config.Config.STATION_CODE == "ST-TEST"
def test_station_code_defaults_to_none_when_missing(monkeypatch):
monkeypatch.delenv("STATION_CODE", raising=False)
import config
importlib.reload(config)
assert config.Config.STATION_CODE is None