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.4.0.tar.gz (4.1 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.4.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agenv-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0a2d96531b61970ed47848a9386409cf3a9e271549e6b5d365ff1583a8aa13cc
MD5 34b720ad22334348047576ea9715d499
BLAKE2b-256 45c51bb0887cec34aa2a17003eaa7825616bb03df782c0ddd632eafa8c151c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for agenv-0.4.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.4.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for agenv-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 227f80d38d83aa64e13d10826e21447c5cd51711478f7f024c4b5720f6e32461
MD5 5a440525e1b631fab55a4b9578a8a428
BLAKE2b-256 36a634a785fde87aa31a5aa699a215b82a19d4e9cdf6c84da7b6512c32f02749

See more details on using hashes here.

Provenance

The following attestation bundles were made for agenv-0.4.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