ConfigLoader#
- class ConfigLoader(app, log=None)#
Bases:
objectAbstract ConfigLoader.
Define the public API that will be used by the
Applicationobject, as well as some common logic.- Parameters:
app (Application) – Parent application that created this loader.
log (Logger) – Logger instance.
- add(cv)#
Add key to configuration dictionnary.
- Raises:
MultipleConfigKeyError – If the key is already present in the current configuration.
- Parameters:
cv (ConfigValue)
- Return type:
None
- app: Application#
Parent application that created this loader.
It will be used to deal with exceptions, and to resolve/normalize the config once loaded.
- apply_application_trait(cv)#
Apply config for Application.
- Parameters:
cv (ConfigValue)
- Return type:
None
- clear()#
Empty the config.
- Return type:
None
- config: dict[str, ConfigValue]#
Configuration dictionnary mapping keys to ConfigValues.
It should be a flat dictionnary.
- get_config(*args, apply_application_traits=True, resolve=True, **kwargs)#
Load and return a proper configuration dict.
This method clears the existing config, call
load_config()to populate theconfigattribute, apply parameters to the root application, resolve/normalize the config and return it.Parameters to be applied to the application before proper resolution of the whole configuration are detected in a simple manner. Only single level keys corresponding to an existing application trait are used.
- Parameters:
args (Any) – Passed to
load_config().kwargs (Any) – Passed to
load_config().apply_application_traits (bool)
resolve (bool)
- Return type:
- load_config(*args, **kwargs)#
Populate the config attribute from a source.
- Not implemented:
- Parameters:
- Return type: