Created
April 9, 2018 21:57
-
-
Save douglasmiranda/e14c3119cc1d0931999c6f90d3948673 to your computer and use it in GitHub Desktop.
gconfigs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pipenv install gconfigs # or pip install gconfigs | |
$ pipenv run python | |
>>> from gconfigs import envs, configs, secrets | |
>>> envs('HOME', default='/') | |
'/' | |
>>> configs.as_bool('DEBUG', default=False) | |
False | |
>>> configs('DATABASE_USER') | |
'user' | |
>>> secrets('DATABASE_PASS') | |
'123' | |
>>> # envs, configs and secrets are iterables | |
>>> from gconfigs import envs | |
>>> for env in envs: | |
... print(env) | |
... print(env.key) | |
... print(env.value) | |
... | |
EnvironmentVariable(key='ENV_TEST', value='env-test-1') | |
ENV_TEST | |
env-test-1 | |
... | |
>>> 'ENV_TEST' in envs | |
True | |
>>> envs.json() | |
'{"ENV_TEST": "env-test-1", "HOME": "/root", ...}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment