skip to navigation
skip to content

envsettings 2.1.0

Read settings from environment variables.

Easily read settings from environment variables. Reading settings from environment variables allows complete isolation between application and configuration data.

Read the Twelve-Factor App’s relevant section for more rationale behind this approach.

Usage

The following example will read the environment variables into configuration values host, port, and debug, cast to the expected type:

from envsettings import SettingsReader

r = SettingsReader(
    host=("HOST", "host", str),
    port=("PORT", "port", int),
    debug=("DEBUG", "debug", bool),
)

if r.debug:
   print("Running in debug mode")

myapp.run(r.host, r.port, debug=r.debug)

Boolean values can be either true, yes, or on and are case insensitive.

Contributing

Any feedback is welcome, and please report any bugs you encounter on the project’s issue tracker.

Patches or merge requests are welcome.

Licence

envsettings is licensed under the ISC licence (functionally equivalent to the MIT licence). See LICENCE.md for details.

Copyright (c) 2014-2015 Hugo Osvaldo Barrera <hugo@barrera.io>

 
File Type Py Version Uploaded on Size
envsettings-2.1.0-py3-none-any.whl (md5) Python Wheel py3 2017-01-21 3KB
envsettings-2.1.0.tar.gz (md5) Source 2017-01-21 3KB