Skip to content

SettingsManager

Bases: SettingsBuilder, SettingsRoot

add_aws_secrets_manager

add_aws_secrets_manager(
    secret_id: str,
    region: str | None = None,
    url: str | None = None,
) -> None

Add a settings provider that reads settings values from AWS Secrets Manager.

add_azure_key_vault

add_azure_key_vault(
    url: str, credential: AsyncTokenCredential | None = None
) -> None

Add a settings provider that reads settings values from Azure Key Vault.

add_environment_variables

add_environment_variables() -> None

Add a settings provider that reads settings values from environment variables.

add_json_file

add_json_file(path: str, optional: bool) -> None

Add a settings provider that reads settings values from a JSON file.

get_model

get_model(model_type: type[TModel]) -> TModel

Get a settings model of the specified type. The settings values will be mapped to the model fields by their names.

get_required_value

get_required_value(
    key: str, value_type: type[TField] | type[str] = str
) -> TField

Get a setting value by its key or raise an error if the key is not found or the value is None. Optionally, validate the setting value against the specified type.

get_section

get_section(key: str) -> SettingsSection

Get a settings section for the specified key. A settings section represents a subsection of the settings values that share a common key prefix.