Skip to content

add layered configuration

Maciej Pawel Szymanski requested to merge maszyman-layered-configuration into master

Closes #7 (closed) #1 (closed)

This MR adds a simple function called lbnightly_settings() returning layered configuration store, based on configurator.

For now, we have three layers:

We could extend the list with e.g. environment variables.

Example of usage:

>>> from lb.nightly.configuration import lbnightly_settings
>>> settings = lbnightly_settings()
>>> settings.couchdb.url
'http://localhost:8080/couchdb/nightly-builds'
>>> settings['couchdb']['url']
'http://localhost:8080/couchdb/nightly-builds'
>>> settings.data
{'couchdb': {'url': 'http://localhost:8080/couchdb/nightly-builds'}, 'rabbitmq': {'url': 'amqp://guest:guest@localhost:5672'}, 'mysql': {'url': 'db+mysql://'}, 'artifacts': {'uri': 'http://localhost:8081/repository/nightly_builds_artifacts/'}, 'logs': {'uri': 'http://localhost:8081/repository/nightly_builds_logs/'}, 'elasticsearch': {'uri': 'http://localhost:9200'}}

I looked also at much more powerful libraries like dynaconf, hydra or environ-config, but I'm not sure if that's needed for our use case.

Edited by Maciej Pawel Szymanski

Merge request reports