Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months 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 (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T03:46:51.000Z (over 3 years ago)
- Last Synced: 2024-10-07T07:59:51.526Z (4 months ago)
- Topics: configuration, configuration-management, devops, python
- Language: Python
- Homepage: https://github.com/prahladyeri/cfgsaver
- Size: 143 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![pypi](https://img.shields.io/pypi/v/cfgsaver.svg)
![python](https://img.shields.io/pypi/pyversions/cfgsaver.svg)
![license](https://img.shields.io/github/license/prahladyeri/cfgsaver.svg)
![docs](https://readthedocs.org/projects/cfgsaver/badge/?version=latest)
[![patreon](https://img.shields.io/badge/Patreon-brown.svg?logo=patreon)](https://www.patreon.com/prahladyeri)
[![paypal](https://img.shields.io/badge/PayPal-blue.svg?logo=paypal)](https://paypal.me/prahladyeri)
[![follow](https://img.shields.io/twitter/follow/prahladyeri.svg?style=social)](https://twitter.com/prahladyeri)# cfgsaver
![project logo](https://raw.githubusercontent.com/prahladyeri/cfgsaver/master/logo.png)
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 cfgsaverdef 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