config.config_from_yaml()
A factory that returns decorator functions which extends a
Usage
config.config_from_yaml(
prefix=DEFAULT_CONFIG_PREFIX, dotenv_prefix=DEFAULT_DOTENV_PATH
)pydantic BaseSettings class to read in parameters from a config yaml. It replaces (or adds) config settings to the BaseSettings class that configures the priorities for parameter sources as follows (highest priority first): - parameters passed using **kwargs - environment variables - file secrets - yaml config - path specified via env variable {prefix}_CONFIG_YAML (all uppercase) - yaml config - file named .{prefix}.yaml and placed in the CWD or home dir - defaults
Parameters
prefix: str = DEFAULT_CONFIG_PREFIX-
(str, optional): When defining parameters via environment variables, all variables have to be prefixed with this string following this pattern “{prefix}_{actual_variable_name}“. Moreover, this prefix is used to derive the default location for the config yaml file (”~/.{prefix}.yaml”). Defaults to “ghga_services”.
dotenv_prefix: Path = DEFAULT_DOTENV_PATH- (Path, optional): When defining parameters via dotenv files, this prefix is used to set the path for the dotenv files. The final path used is constructed as “{dotenv_prefix}/.env”. Defaults to “/secrets”.