Skip to main content

define and set application properties using a file and enviornment variables

Project description

pyenvprops

Description

This module offers the ability to define and set application properties using both a property file and enviornment variables. It was originally intended to ease application configuration for apps running in Docker containers.

The property file can be formatted in JSON or YAML. A "properties" object is defined in the file. Each entry should be an object with at least a "type" field. The supported types are defined in EnvProps.supported_datatypes. The key of the object will be name of the property. This is also the name of the enviornment variable for which the parser will check. Optionally, a "default" field can be defined for each property which will specify a value to use if one is not provided via the enviornment. If no default is provided, EnvProps will throw an exception if no value is found in the enviornment.

Examples

Please see files/properties.json and files/properties.yaml for property file examples.

Using with Flask/Quart

from envprops import EnvProps
from flask import Flask

app = Flask(__name__)
env = EnvProps('properties.json')
app.config.update(env.asdict())

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 pyenvprops, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size pyenvprops-0.3.0-py3-none-any.whl (3.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pyenvprops-0.3.0.tar.gz (3.0 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 DigiCert DigiCert EV certificate StatusPage StatusPage Status page