Skip to main content

A tiny package for enforcing the existence of required environment variables.

Project description

Envorce

Mini package for verifying environment variables at runtime to catch misconfigurations as early as possible.

Configuration

There are a number of different ways in which you can specify the environment variables which need to be "envorced". They can be used individually or simultaneously.

Via environment variables

Set the environment variable ENVORCE as a comma-separated list of required environment variable.

ENVORCE=DB_USERNAME, DB_PASSWORD, API_URL

Then, in your top-level script simply call

from envorce import envorce

envorce()

Via function arguments

Specify required variables by passing them into the top-level function call.

from envorce import envorce

envorce("AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY")

Via configuration file

Add a file envorce.toml into your project repository and set the key envorce as a list of required environment variables.

# envorce.toml
envorce = ["DATABASE_HOST", "DATABASE_USERNAME", "DATABASE_PASSWORD"]

Then, in your top-level script simply call

from envorce import envorce

envorce()

The program will continue to search parent directories for the file envorce.toml until reaching the home directory or the iteration limit.

Project details


Download files

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

Source Distribution

envorce-1.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envorce-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file envorce-1.0.0.tar.gz.

File metadata

  • Download URL: envorce-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for envorce-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1f7f2fa7b550f05fe4bb613994eecbf0654908f4db3ed89257e29b042620c02d
MD5 facf998b4c3d03d3eceb51c433283d42
BLAKE2b-256 3562213103f92ea47c8eac703c891252fbaa0d96013c4cb207a7cf30f7c5352a

See more details on using hashes here.

File details

Details for the file envorce-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: envorce-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for envorce-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e96fd043f8be6387b38313c3ac289d12a237a54cb27e82f180c84db1f9ecdb89
MD5 d5cdfffb5c630d831b0310328fe09e4f
BLAKE2b-256 f749388c24adbf31cbb1781f7cc09e7794d60d5db71ff9e4d1f46f1a98eb6aab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page