Skip to content

Simple method used to load configuration variables from different sources.

License

Notifications You must be signed in to change notification settings

adonisnafeh/iconf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iconf Latest version on Pypi

Build Status - master branch Coverage of the code quality License

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:

  1. Environment
  2. JSON - used if path is set and the file exists
  3. 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.

About

Simple method used to load configuration variables from different sources.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages