https://github.com/prahladyeri/cfgsaver
Module to save and fetch configuration data in a standard path and format
https://github.com/prahladyeri/cfgsaver
configuration configuration-management devops python
Last synced: about 1 year ago
JSON representation
Module to save and fetch configuration data in a standard path and format
- Host: GitHub
- URL: https://github.com/prahladyeri/cfgsaver
- Owner: prahladyeri
- License: mit
- Created: 2019-06-18T20:10:26.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T03:46:51.000Z (over 4 years ago)
- Last Synced: 2025-03-21T02:22:00.365Z (about 1 year ago)
- Topics: configuration, configuration-management, devops, python
- Language: Python
- Homepage: https://github.com/prahladyeri/cfgsaver
- Size: 143 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README




[](https://www.patreon.com/prahladyeri)
[](https://paypal.me/prahladyeri)
[](https://twitter.com/prahladyeri)
# cfgsaver

Python library to save and fetch configuration data in a standard/conventional path and format.
# Installation
```bash
pip install cfgsaver
```
# Usage
Import the `cfgsaver` module to save/read configuration values in your source files:
```python
from cfgsaver import cfgsaver
def save_config():
# saves configuration data to ~/.config//cfg.json
# unless cfgpath parameter is overridden:
config = {
'name': 'Prahlad',
'language': 'Python',
'framework': 'Flask'
}
cfgsaver.save('', config)
def get_config():
# gets configuration data from ~/.config//cfg.json
# unless cfgpath parameter is overridden:
config = cfgsaver.get("") #returns None if config file doesn't exist
def prompt_user():
# prompts user for config keys and saves resulting values as per save_config()
config = {
'name': '',
'language': '',
'framework': ''
}
config = cfgsaver.get_from_cmd("", config.keys())
```
For information on shipping default configuration data packaged with your app using `setup.py`, read [detailed docs](https://cfgsaver.readthedocs.io/en/latest/).
# Documentation
Detailed docs are available at .
# Attribution