Updated
On this page
Config loading utility providing standalone TOML config file parsing with optional Pydantic validation and environment variable overrides.
#src.fastware.config
#src.fastware.config
Config loading utility providing standalone TOML config file parsing with optional Pydantic validation and environment variable overrides.
Provides a standalone TOML config loader with optional Pydantic validation. Not tied to strictcli's config system -- apps call load_config() at startup and pass the result into lifespan state.
#load_config
python
def load_config(path: str | Path, schema: type[T] | None=None) -> T | dict[str, Any]Load a TOML config file.
Args:
path: Path to the TOML file.schema: Optional Pydantic model class. When provided, the parsed
TOML dict is validated against the model and a model instance is returned. When None, the raw dict is returned.
Raises:
FileNotFoundError: If the config file does not exist.tomllib.TOMLDecodeError: If the file is not valid TOML.pydantic.ValidationError: If schema is provided and validation fails.