Adapter based configuration handler (supports ENV and AWS SSM).
Project description
blinkist-config-python
The package simplifies accessing different configuration stores. The current supported stores are: ENV - read from the application's environment variable SSM - read from the AWS SSM Parameter Store
Usage
ENV
import blinkistconfig.Config
# Setup the Config to use the ENV as config store
config = blinkistconfig.Config(env="development", app_name="my_nice_app", adapter_type="ENV")
my_config_value = config.get("some/folder/config")
# This is being translated to ENV["SOME_FOLDER_CONFIG"]
SSM
For SSM this tool simulates namespace/directory functionality with each application having its own. By default requesting a parameter myparam1 within the application called my_nice_app will query the SSM parameter store for /application/my_nice_app/myparam1.
This harmonizes nicely with the ability of the SSM param store to do a prefix search. The /application/my_nice_app prefix is the default "private" scope.
import blinkistconfig.Config
# setup the Config to use the SSM as config store
config = blinkistconfig.Config(env="development", adapter_type="SSM", app_name="my_nice_app")
my_config_value = config.get("some/folder/config")
# This will try to get a parameter from SSM at "/application/my_nice_app/some/folder/config"
It is also possible to also have other scopes, possibly shared between the applications. For example
my_config_value = config.get("another/config", scope="global")
# This will replace `my_nice_app` with `global` and try to resolve "/application/global/another/config"
Development
To install development requirements
pip install -r requirements/dev.txt
pip install -e .
To run tests
AWS_DEFAULT_REGION="us-east-1" pytest --spec
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/blinkist/blinkist-config-python.
License
The package is available as open source under the terms of the MIT License.
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
Built Distribution
Hashes for blinkistconfig-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 474ba59adb549e197da43b0db2eff66ca23da71888d14d62f5ca5da3eea2b31a |
|
MD5 | fd3863686b798eef9045d696ffcf7eeb |
|
BLAKE2b-256 | dc51dbd83720af8571c8ad10626185c0244722ffc86b5039a065cae752a22220 |