https://github.com/spacetab-io/configuration-python
Configuration module for microservices written on Python. Specially created for follow up corporate standards of application configuration.
https://github.com/spacetab-io/configuration-python
config configuration python
Last synced: about 1 month ago
JSON representation
Configuration module for microservices written on Python. Specially created for follow up corporate standards of application configuration.
- Host: GitHub
- URL: https://github.com/spacetab-io/configuration-python
- Owner: spacetab-io
- License: mit
- Created: 2020-04-16T15:50:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-13T11:12:19.000Z (almost 5 years ago)
- Last Synced: 2025-03-16T15:07:49.280Z (2 months ago)
- Topics: config, configuration, python
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Python Microservice configuration module
-------------------------------------[](https://circleci.com/gh/spacetab-io/configuration-python/tree/master)
Configuration module for microservices written on Python. Specially created
for follow up corporate standards of application configuration.## Installation
```bash
pip3 install config_pkg
```## Usage
By default path to configuration directory and application stage
loading from `/configuration` with `defaults` stage.1) Simple
```python
from config_pkg import PKGpkg = PKG()
pkg.load()all_config = pkg.get_all()
foo_bar = pkg.get('foo.bar')
```2) If u would like override default values, you can pass 2 arguments to
class constructor or set up use setters.```python
from config_pkg import PKGpkg = PKG('/configuration', 'test')
pkg.load()foo_bar = pkg.get('key') # full example on the top
```3) If the operating system has an env variables `CONFIG_PATH` and `STAGE`,
then values for the package will be taken from there.```bash
export CONFIG_PATH=/configuration
export STAGE=test
``````python
from config_pkg import PKGpkg = PKG()
pkg.load() # loaded files from /configuration for prod stage.foo_bar = pkg.get('key') # full example on the top
```4) If u want to see logs and see how load process working,
pass you application logger to the following method:```python
from config_pkg import PKGpkg = PKG(logger=logger) # loggining.Logger compatible logger
pkg.load()foo_bar = pkg.get('key') # full example on the top
```That all.
## Depends
* Python 3.x
* pip for install package## License
MIT