YAML loader with support for !secret, !env, and !enc tags
Project description
seyaml
seyaml is a Python YAML loader and CLI tool supporting custom tags:
!env VAR— load environment variable, supports indexing like!env VAR[0]for comma separated values!secret key— load secret from a provided dictionary, supports indexing like!secret api_key[1]for comma separated values!enc ENCRYPTED_VALUE— decrypt AES-256-GCM encrypted base64 string with a provided key
You could you any combination of features, they all optional.
Constraints
- env variables always UPPERCASE strings
- secret values always lowercase strings
- env values always Base64 strings
Installation
pip install seyaml
Usage
Python API
from seyaml.loader import load_seyaml
import base64
secrets = {
"api_key": "key1,key2,key3",
"simple": "value"
}
decryption_key = base64.b64decode("YOUR_BASE64_32_BYTE_KEY")
config = load_seyaml("config.yaml", secrets=secrets, decryption_key=decryption_key)
print(config)
YAML Example
database:
url: !secret simple
token: !secret api_key[2]
user: !env DB_USER
password: !enc gN0jA1u+9aC9X9DkR3ABxF3P5pSXXTFsm/u5yH7sy94gQ==
CLI Usage
Generate a secure AES-256 key (base64 encoded):
seyaml generate-key
Encrypt plaintext:
seyaml encrypt "my secret text" --key YOUR_BASE64_KEY
Decrypt ciphertext:
seyaml decrypt ENCRYPTED_BASE64_STRING --key YOUR_BASE64_KEY
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
seyaml-0.1.1.tar.gz
(5.4 kB
view details)
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 seyaml-0.1.1.tar.gz.
File metadata
- Download URL: seyaml-0.1.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3a7f4387266535787aa9bfb1f17f0bd84db9bbed52e6a84701ff98f0e9d9774
|
|
| MD5 |
cbb98a23a514db7c1a1d47a88ae26f56
|
|
| BLAKE2b-256 |
5015dd00d0f4dcecdb1e2745505c86a6828d086ccee07d8aa685f6b9a55b680c
|
File details
Details for the file seyaml-0.1.1-py3-none-any.whl.
File metadata
- Download URL: seyaml-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a158d4c99c7fe375d4b3a88f1d577bc39091b09818b025a29470c4af70e2a63
|
|
| MD5 |
67f6f4c8295a382dad26743592c2fc7a
|
|
| BLAKE2b-256 |
9162141a2e9756abe0af7369daf48bcf63ffc5d7bd88e612b1257baaf9aad5d9
|