core.config_loader module
Per-service configuration loading and validation.
load_and_validate() loads the shared config.Config and
checks that the keys a given service actually needs are present and
pass lightweight semantic checks (e.g. redis_url must look like a
Redis URL). On any missing or invalid key it raises SystemExit so
a misconfigured service fails fast at boot instead of running in a
broken state.
- core.config_loader.load_and_validate(required_keys)[source]
Load the shared Config and fail fast unless the required keys are valid.
Loads the monolithic
config.Configand, for every key a service declares it needs, checks that the value is present (non-None, non-empty) and passes any matching semantic validator in_VALIDATORS(e.g.redis_urlmust start with a Redis scheme). If anything is missing or fails its check, it raisesSystemExitwith a summary so a misconfigured service crashes at boot rather than running in a half-broken state. Reads no Redis or network resources of its own beyond whateverConfig.load()does.Called at service startup by each microservice entrypoint with the subset of keys that service requires; also exercised directly by
tests/core/migration/test_config_loader.py.- Parameters:
required_keys (
list[str]) – Attribute names onconfig.Configthat must be present (and valid where a semantic validator exists).- Returns:
The loaded, validated configuration object.
- Return type:
- Raises:
SystemExit – If any required key is missing or fails semantic validation.