yaml_settings_source
YAML settings source module.
Classes
YamlSettingsSource
Bases: PydanticBaseSettingsSource
A settings source that reads configuration values from a YAML file.
Note that YAML settings that are not referenced explicitly by the pydantic-settings model will be ignored
To properly work, an environment variable with the same name as contained in ENV_SETTINGS_YAML needs to be set. Otherwise no configuration will be loaded and this settings source will silently return nothing
Attributes
Functions
__call__
Loads the settings YAML file and populates the settings model fields.
Returns:
-
Dict[str, Any]
–Dict[str, Any]: A dictionary containing the populated settings model fields.
get_field_value
Retrieves the value of a specific field from the loaded configurations. Note that the first configuration match found will be returned.
Parameters:
-
field
(FieldInfo
) –The field information object.
-
field_name
(str
) –The name of the field.
Returns:
-
Tuple[Any, str, bool]
–Tuple[Any, str, bool]: A tuple containing the field value, field key, and a boolean indicating whether the field is complex.