Skip to main content

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:

  1. HEA_ENCRYPTION_KEY_FILE environment variable (path to key file)
  2. HEA_ENCRYPTION_KEY_FILE in .env (path to key file)
  3. HEA_ENCRYPTION_KEY environment variable (inline key)
  4. HEA_ENCRYPTION_KEY in .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/

Deploying: Run pyproject-build to build a source package and weel.

To deploy, the twine command is configured with a custom .pypirc file located at .devcontainer/pyproject-pypirc. Add your repositories and credentials to that file, and twine upload -r should work.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hea_scripts-1.0.0b2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hea_scripts-1.0.0b2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file hea_scripts-1.0.0b2.tar.gz.

File metadata

  • Download URL: hea_scripts-1.0.0b2.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for hea_scripts-1.0.0b2.tar.gz
Algorithm Hash digest
SHA256 dd1e1265664063ef14546a2497c590d26360f0ecb1f58d634be5d3a46832d7eb
MD5 a48cc229fe55a229fe41b8f7604234ac
BLAKE2b-256 921b90b7b562df0cf583a16247d319ac92eec66fa8d512391ca40f5bce7d8bc5

See more details on using hashes here.

File details

Details for the file hea_scripts-1.0.0b2-py3-none-any.whl.

File metadata

  • Download URL: hea_scripts-1.0.0b2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for hea_scripts-1.0.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7437a94d410bb094a09f0c521b0b81d2c451126ee96fc7da9005848c542f4ff
MD5 e1ba999bc3a5363a4abdc046232df332
BLAKE2b-256 0309593274229d9e16e19d7a5833d5f2d998522e681f1c16ac972a9b8becd94c

See more details on using hashes here.

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