FancyConfig

Class to load the configuration file.

This class behaves like a dictionary that loads a configuration file in yaml format.

If the configuration file does not exist, creates it from template.

Examples

>>> config = FancyConfig()
>>> print(config)
{ 'database': { 'host': '127.0.0.1',
                'name': 'porgs',
                'port': 3306,
                'pwd': 'bacca',
                'user': 'Chew'},
  'env': 'prod',
  'imports': {'star_wars': ['ewok', 'bantha']}}
bff.FancyConfig.__init__(self, path_config_to_load=PosixPath('/home/docs/.config/fancyconfig.yml'), default_config_path=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/bff/envs/latest/lib/python3.7/site-packages/bff-0.2.7+14.g26dad64-py3.7.egg/bff/config.yml'))

Initialization of configuration.

If the folder to store the configuration does not exist, create it. If configuration file does not exist, copy it from default one.

Parameters
  • path_config_to_load (Path, default '~/.config/') – Directory to store the configuration file and load the configuration from.

  • default_config_path (Path, default 'config.yml' current directory.) – Name of the configuration file.