1.9 KiB
Application configuration
PLBA2 reads config.yaml from the application root. The application supplies a
typed decoder for its own fields; PLBA2 validates the common identity and worker
fields and keeps the application model in the same snapshot.
application_id: inventory-service
workers:
inventory_sync:
disabled: false
interval_seconds: 60
cleanup:
pause_seconds: 300
database_url: "..."
application_id is optional. A non-empty value is used unchanged; otherwise
identity resolution uses [project].name from pyproject.toml, then a UUIDv4.
The resolved value is passed to ApplicationRuntime through RuntimeContext
before dependent components start.
Each worker entry may set disabled (default false) and one schedule:
interval_seconds or pause_seconds. Enabled workers need exactly one positive
finite schedule. A disabled worker is skipped at application start and does not
need a schedule. Changing disabled takes effect on the next application start;
valid schedule updates are used when the next worker cycle is planned.
The application defines every other YAML field and its typed model. This file is
for rarely changed technical parameters. Business parameters, feature toggles,
and technical values that must change remotely while the process is running
belong in the application-owned settings table, read through SettingsReader.
Load and validate the initial file before starting dependent components. A
missing, malformed, or invalid initial file raises ApplicationConfigLoadError
and blocks startup. After startup, ApplicationConfigManager.watch checks for
file changes. It swaps in a fully validated snapshot atomically; previously
returned snapshots remain unchanged. If an update is invalid or unreadable,
reload_if_changed returns a failure and the manager keeps the last valid
snapshot. The watcher passes that error to the application's callback.