hierarchical configuration
Project description
ConfigChain
The key feature of ConfigChain, is the ability to dynamically create a hierarchical configuration by composition and override it through config files and the command line.
- Installation :
pip install configchain --upgrade
Usage
from configchain import configchain
cs = configchain("./tests/asset/a.yaml", "./tests/asset/b.yaml", name="app-${app}", profile="profile")
print(cs)
... ConfigSet([('app-hello',
Config([('*',
ConfigSnippet([('by', 'tao'),
('env', ['ENV=${profile}', 'PROCESSES=32']),
('at', 'aws'),
('app', 'hello')])),
('test',
ConfigSnippet([('by', 'tao'),
('env',
['ENV=${profile}',
'PROCESSES=32',
'PROCESSES=1']),
('at', 'docker'),
('profile', 'test'),
('app', 'hello')]))])),
('*',
Config([('*',
ConfigSnippet([('by', 'luo'),
('env', ['ENV=${profile}']),
('at', 'aws')])),
('test',
ConfigSnippet([('by', 'luo'),
('env', ['ENV=${profile}']),
('at', 'docker'),
('profile', 'test')]))]))])
a.yaml
by: luo
env:
- ENV=${profile}
at: aws
---
profile: test
at: docker
b.yaml
app: hello
by: tao
env:
- PROCESSES=32
---
profile: test
env:
- PROCESSES=1
License
ConfigChain is licensed under MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
configchain-0.3.7.tar.gz
(6.4 kB
view hashes)
Built Distribution
Close
Hashes for configchain-0.3.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec465301eb799df2390e35e08330c279220a570c1150972d207a032e97e6ae75 |
|
MD5 | b6b2e205b0deb67d76a150a1ff0d7496 |
|
BLAKE2b-256 | 61e51a3737637dacdc2ff99c46af7e57f7b27eb8748272b20d964a0a0c519289 |