This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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>

Release History

Release History

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 Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
envsettings-2.1.0-py3-none-any.whl (3.9 kB) Copy SHA256 Checksum SHA256 py3 Wheel Jan 21, 2017
envsettings-2.1.0.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source Jan 21, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting