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:
- The
identityparameter provided toload_age_env() - The
AGE_SECRET_KEYenvironment variable - The
AGE_SECRET_KEY_FILEenvironment variable (path to key file) - The default key file:
$HOME/.age/age.key
If no valid identity is found, decryption will fail.
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a2d96531b61970ed47848a9386409cf3a9e271549e6b5d365ff1583a8aa13cc
|
|
| MD5 |
34b720ad22334348047576ea9715d499
|
|
| BLAKE2b-256 |
45c51bb0887cec34aa2a17003eaa7825616bb03df782c0ddd632eafa8c151c1a
|
Provenance
The following attestation bundles were made for agenv-0.4.0.tar.gz:
Publisher:
python-publish.yml on zachcheung/agenv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenv-0.4.0.tar.gz -
Subject digest:
0a2d96531b61970ed47848a9386409cf3a9e271549e6b5d365ff1583a8aa13cc - Sigstore transparency entry: 170448860
- Sigstore integration time:
-
Permalink:
zachcheung/agenv@5231ef7fa35fb2c07962917c31eae1f0651bac83 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/zachcheung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5231ef7fa35fb2c07962917c31eae1f0651bac83 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
227f80d38d83aa64e13d10826e21447c5cd51711478f7f024c4b5720f6e32461
|
|
| MD5 |
5a440525e1b631fab55a4b9578a8a428
|
|
| BLAKE2b-256 |
36a634a785fde87aa31a5aa699a215b82a19d4e9cdf6c84da7b6512c32f02749
|
Provenance
The following attestation bundles were made for agenv-0.4.0-py3-none-any.whl:
Publisher:
python-publish.yml on zachcheung/agenv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenv-0.4.0-py3-none-any.whl -
Subject digest:
227f80d38d83aa64e13d10826e21447c5cd51711478f7f024c4b5720f6e32461 - Sigstore transparency entry: 170448864
- Sigstore integration time:
-
Permalink:
zachcheung/agenv@5231ef7fa35fb2c07962917c31eae1f0651bac83 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/zachcheung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5231ef7fa35fb2c07962917c31eae1f0651bac83 -
Trigger Event:
push
-
Statement type: