Metadata-Version: 2.4
Name: ruth-configurator
Version: 2000.3.13
Summary: Python configuration package
Author-email: Eyes Rutherford <ruth-tools@inbox.ru>
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: ruth-tokenizer>=2020.0.0
Requires-Dist: ruth-tools[common]>=2020.1.1
Requires-Dist: PyYAML>=6.0.3
Dynamic: license-file

# Configurator

This module try to get all application configurations from files and system environment and stores them as a global object to be used later.
Should be called at the beginning of main program.


Examples:

- [ ] load config:
    ```python
    from tools.configurator import Config, ConfigNode, ConfigLoader, ConfigLoaderIgnore
    Config.load(
        config=ConfigNode(
            config=ConfigLoader(
                path='../configs_folder',  # config files path
                paths=[  # or list of paths
                    './configs_folder_1',
                    './configs_folder_2'
                ],
                env_prefix='env_prefix',
                env_separator='::',
                ignore=ConfigLoaderIgnore(  # files / paths / env-vars to be ignored
                    file='test.py',  # file name
                    files=['test_1.py', 'test_2.py'],  # or list of file names
                    file_mask='test*',  # file name mask
                    file_masks=['templ-*', 'template-*']  # or list of file name masks
                ),
                extension='py',  # file extension
                extensions=['json', 'yaml'],  # or list of file extensions
                order=['env', 'json', 'yaml']  # loading config file order, Last Loaded value overrides Existing value for the same key
            ).config,
            read_only=True  # safe loading, forbid config changes after loading
        )
    )
    ```
  

- [ ] config use:
    ```python
    from tools.configurator import Config
    
    print(f'param: {Config.param_group.param_subgroup.param_name}')
    ```
