Simple method used to load configuration variables from different sources.
Project description
Simple method used to load configuration variables from different sources.
Supports loadings variables from the environment, json file and/or Django settings.
The method will search for the keys in any of the 3 sources and returns the first match.
Search order:
Environment
JSON - used if path is set and the file exists
Django settings - used if Django is installed
This is useful if you need to set configuration variables(SECRET_KEY, DATABASE_NAME, etc…) via environment on a CI server and load the same variables from a json file in a production environment.
Installation
pip install iconf (or add to your requirements.txt)
Usage
import iconf
# find and return keys from environment variables and/or django settings
# and/or json file
configs = iconf.get(keys=["KEY1", "KEY2"], path="configs.json")
# import full json file
configs = iconf.get(path="configs.json")
# import from environment and/or django settings
configs = iconf.get(["KEY1", "KEY2"])
Test
run tests with python -m unittest discover
License
3 Clause BSD.
Bug report and Help
For bug reports open a github ticket. Patches gratefully accepted.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iconf-0.0.2.tar.gz.
File metadata
- Download URL: iconf-0.0.2.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43b1439dd03d94c195cc1b31a103bed77e4fce3264c7b64060b0139fa237ebb7
|
|
| MD5 |
71a796a372a8f3ef2bbffd975beae171
|
|
| BLAKE2b-256 |
b90e515f33c829cf9aacaff82b6f47a2df1d9758e7915824458eba8cfdce4e38
|
File details
Details for the file iconf-0.0.2-py3.7.egg.
File metadata
- Download URL: iconf-0.0.2-py3.7.egg
- Upload date:
- Size: 3.4 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc97acb2cb6c2f3fd6297bd1cd4474323e31431a4b8911214af544a15690a14d
|
|
| MD5 |
ff058b4060d3857b31cac68f063595da
|
|
| BLAKE2b-256 |
2147ace6bbde0a0663478f419813fd24396630d4516653ea587497ce66aff783
|