weaver.config
¶
Module Contents¶
-
weaver.config.
get_weaver_configuration
(container) → AnyStr[source]¶ Obtains the defined operation configuration mode.
Returns: one value amongst weaver.config.WEAVER_CONFIGURATIONS
.
-
weaver.config.
get_weaver_config_file
(file_path, default_config_file, generate_default_from_example=True) → AnyStr[source]¶ Validates that the specified configuration file can be found, or falls back to the default one.
Handles ‘relative’ paths for settings in
WEAVER_DEFAULT_INI_CONFIG
referring to other configuration files. Default file must be one ofWEAVER_DEFAULT_CONFIGS
.If both the specified file and the default file cannot be found, default file under
WEAVER_DEFAULT_INI_CONFIG
is auto-generated from the corresponding.example
file if :paramref:`generate_default_from_example` isTrue
. If it isFalse
, an empty string is returned instead without generation since no existing file can be guaranteed, and it is up to the caller to handle this situation as it explicitly disabled generation.Parameters: - file_path – path to a configuration file (can be relative if resolvable or matching a default file name)
- default_config_file – one of
WEAVER_DEFAULT_CONFIGS
. - generate_default_from_example – enable fallback copy of default configuration file from corresponding example.
Returns: absolue path of the resolved file.