Skip to main content

Dad for your config

Project description

Class for creating configuration models

Install

pip install abconfig

File + Env

>>> from abconfig import ABConfig
>>> 
>>> class DBConfig(ABConfig):
...     file = '/path/to/your/config_file.yaml'
...     postgres = dict(
...         host='127.0.0.1',
...         port='5432',
...         user='your_user',
...         password='your_pass'
...     )
... 
>>> dbconfig = DBConfig()
>>> print(dbconfig.get())
{'postgres': {'host': '127.0.0.1', 'port': '5432', 'user': 'name', 'password': 'pass'}}
>>> print(dbconfig['postgres']['host'])
'127.0.0.1'

Vault

>>> class Vault(ABConfig):
...     vault = dict(
...             kv_version=1,
...             enabled=False,
...             addr='127.0.0.1',
...             path='default/project',
...             token=False,
...     )
... 
>>> config = Vault()
>>> print(config.get())
{'your': 'secrets_from_vault'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abconfig-0.3.0.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page