Skip to main content

Read settings from environment variables.

Project description

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>

Project details


Release history Release notifications

This version
History Node

2.1.0

History Node

2.0.0

History Node

1.1.1

History Node

1.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
envsettings-2.1.0-py3-none-any.whl (3.9 kB) Copy SHA256 hash SHA256 Wheel py3 Jan 21, 2017
envsettings-2.1.0.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None Jan 21, 2017

Supported by

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