A collection of scripts for the HEA project.
Project description
HEA Scripts
Contains scripts for configuring a Health Enterprise Analytics (HEA) deployment. The primary scripts handle Fernet symmetric encryption of secrets stored in .env files.
Setup
Install the package in editable mode (the dev container does this automatically):
pip install --user -e .
Requires Python 3.10 - 3.12.
Usage
Generate an encryption key
hea-gen-encryption-key
Save the printed key in your .env file as HEA_ENCRYPTION_KEY, or in a dedicated file (recommended) referenced by HEA_ENCRYPTION_KEY_FILE. If using a file, restrict its permissions:
chmod 600 hea_encryption_key.txt
Encrypt / decrypt a value
# Encrypt a literal value
hea-encryption --encrypt <value>
# Encrypt a property already in .env (result is written to stdout with {crypt} prefix)
hea-encryption --encrypt -p <PROPERTY_NAME>
# Decrypt a token
hea-encryption --decrypt <token>
# Read input from a file
hea-encryption --encrypt -f <file>
hea-encryption --decrypt -f <file>
# Write output to a file instead of stdout
hea-encryption --encrypt <value> -o <output_file>
Configuration
Scripts expect a .env file in the working directory. The encryption key is resolved in this order:
HEA_ENCRYPTION_KEY_FILEenvironment variable (path to key file)HEA_ENCRYPTION_KEY_FILEin.env(path to key file)HEA_ENCRYPTION_KEYenvironment variable (inline key)HEA_ENCRYPTION_KEYin.env(inline key)
Encrypted values stored in .env use the format:
PROPERTY={crypt}<fernet-token>
Contributing
Install the package with the dev optional dependencies to get pytest:
pip install --user -e ".[dev]"
Run the tests:
python -m pytest tests/
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
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 hea_scripts-1.0.0b1.tar.gz.
File metadata
- Download URL: hea_scripts-1.0.0b1.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd2ecc2b1652f05ef3e0a21373ec8739d65537fd91708bae1bd610bb938f80b5
|
|
| MD5 |
f17942f89777e434db2df03b2da91f7c
|
|
| BLAKE2b-256 |
3ba392613b56d2265d619232c4b55bb9ddd360eb8c44cc544b990696aa6d93cf
|
File details
Details for the file hea_scripts-1.0.0b1-py3-none-any.whl.
File metadata
- Download URL: hea_scripts-1.0.0b1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4dc3fc8b90835994395b598dd652e8cfeb2d5175ec58af952c19593d0b877f8
|
|
| MD5 |
a041c53e039b9b7d99174e8536286c33
|
|
| BLAKE2b-256 |
43719590c1f7eefd91a3380694734c9f87316963d7e21e2cef3a6512692fc2f2
|