Configuration management¶
Module for managing configurations which are stored in Json files.
- class src.lib.config.Config(logger_name)¶
Bases:
object
Loads the designated configuration file and parses the content into blocks of information (sub-dictionaries).
- Parameters
logger_name (string) – The name for the logger object. The recommendation is to keep a single name across the application, so pass here the same used in other parts of the application.
- filename¶
File path with the .json file where the configuration is stored. At initialization its content is None, and the value is updated after the call of the method load_config.
- Type
pathlib path
- json_file¶
File object where the configuration is stored. At initialization its content is None, and the value is updated after the call of the method load_config.
- Type
file object
- json_data¶
Configuration dictionary. At initialization its content is None, and the value is updated after the call of the method load_config.
- Type
dictionary
- assert_filename(filename)¶
Verifies if the file passed for the configuration exists. In case it doesn’t exist, the application will search for a file with the same name and extension, starting from 1 folder above (not more). This is intended to support with some operations from the project, where the starting folder is different from the main application, for example, creating docs in Sphinx.
- get_dictionary()¶
Returns the complete dictionary of configuration
- load_config(filename)¶
- load_config_file()¶
Loads the Json file where the configuration is stored and returns the content in a dictionary format