Configuration

A simple configuration file looks like this:

http:
  port: 1234

a:
  b:
    c: 1

Loading a configuration file:

from aioworkers.core.config import Config

config = Config()
config.load('/path/to/config.yaml')

Access to fields config:

>>> conf.a.b.c
1
>>> conf['a']['b']['c']
1
>>> conf['a.b.c']
1

Overriding

config = Config()
config.load('/path/to/config.yaml',
            '/path/to/override.yaml',
            ...
            'override.yaml')

Override contains:

a.b.c: 2

or:

a.b:
  c: 2

Advanced configure

env:
  logging.root.level: LOG_LEVEL  # replace value to value of environment variable (if set)

logging:
  version: 1
  disable_existing_loggers: false
  root:
    level: ERROR
    handlers: [console]
  handlers:
    console:
      level: INFO
      class: logging.StreamHandler