Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Simple method used to load configuration variables from different sources.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for iconf, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size iconf-0.0.2-py3.7.egg (3.4 kB) File type Egg Python version 3.7 Upload date Hashes View hashes
Filename, size iconf-0.0.2.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page