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

pip install agenv

[!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: ~/.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.2.2.tar.gz (3.8 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.2.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agenv-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5fca95e8c386d0e045135482dc4abc3d3b8975930ed2a00d0ae2d7902d8029dc
MD5 78ba568475a16219eddaf38024d5e20d
BLAKE2b-256 fcd1142b27f73b6b8fd77b50fbdb125ce80907c0f74d9ce68d01e46843b4677a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: agenv-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6bf282673e70d78e472ba887bb156f0c4654658917d57239ebe00a03570ca1e8
MD5 2704007b72abd6a1f24c17c1492416c2
BLAKE2b-256 5f9495fcf0a2b399154fb8be1d7b7de7f313991cdaefe332c5c08a7f82011d35

See more details on using hashes here.

Provenance

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