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.Config and, 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_url must start with a Redis scheme). If anything is missing or fails its check, it raises SystemExit with 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 whatever Config.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 on config.Config that must be present (and valid where a semantic validator exists).

Returns:

The loaded, validated configuration object.

Return type:

Config

Raises:

SystemExit – If any required key is missing or fails semantic validation.