Skip to main content

Load environment variables from age-encrypted files

Project description

agenv

A simple Python package for securely loading environment variables from age encrypted file.

Installation

Basic Installation (Decryption Only)

If you only need to decrypt files at runtime:

pip install agenv

With dotenv Support (Load Encrypted Environment Variables)

If you need to load encrypted environment variables automatically:

pip install agenv[dotenv]

[!NOTE] age must be installed separately, as there is no native Python implementation of age.

Usage

Loading Environment Variables

from agenv import load_age_env

# Decrypts and loads environment variables from a .env.age file
load_age_env(".env.age")

Decrypting and Loading YAML Data

import yaml
from agenv import decrypt

# Decrypts the .age encrypted file and loads the content as a YAML object
yaml_str = decrypt("database.yml.age")
data = yaml.safe_load(yaml_str)
print(data)

Identity Key Selection Order

agenv determines the age identity key in the following order:

  1. The identity parameter provided to load_age_env()
  2. The AGE_SECRET_KEY environment variable
  3. The AGE_SECRET_KEY_FILE environment variable (path to key file)
  4. The default key file: $HOME/.age/age.key

If no valid identity is found, decryption will fail.

License

MIT

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

agenv-0.5.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

agenv-0.5.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file agenv-0.5.0.tar.gz.

File metadata

  • Download URL: agenv-0.5.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for agenv-0.5.0.tar.gz
Algorithm Hash digest
SHA256 4ad27e49afd79e07ccf2e4df9852d209ec23a2fc52d27635ee4ad188eb5faec1
MD5 8c43667bcb33fb897f7043d0587af4d9
BLAKE2b-256 48017f0474589d8d47c5a7f523b6714a5cc3e1fa77819bd9723aaa762c764652

See more details on using hashes here.

Provenance

The following attestation bundles were made for agenv-0.5.0.tar.gz:

Publisher: python-publish.yml on zachcheung/agenv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agenv-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: agenv-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for agenv-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bfbd3b077ec4f2f370e20d35bb04dc436e2e0f19a16dee2f300d2586e4dc53d
MD5 3d3cc14643fb29e6ea9ccc719f7adb1e
BLAKE2b-256 01a3746a34618de480257ad5b9d8f275746a74b47b344092b8635fcea00b295f

See more details on using hashes here.

Provenance

The following attestation bundles were made for agenv-0.5.0-py3-none-any.whl:

Publisher: python-publish.yml on zachcheung/agenv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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