Generate .env files from templates and secrets managers
Project description
T<env>plate
A way to generate .env
files from a template file using remote sources.
Currently, it supports the following remote sources:
- azure keyvault secrets (assumes the az cli is installed and configured)
- kubernetes secrets & configmaps (assumes the kubectl cli is installed and configured)
Usage
-
Install the package. I recommend the use of uv tool or pipx to install it in a global and isolated environment:
uv tool install tenvplate
orpipx install tenvplate
-
Create a .env.template with the following format:
# comment, will be ignored FIXED=will-be-left-untouched ENV_VAR_FROM_K8S_SECRET={{kubernetes/<name-space-name>/secrets/<secret-name>/<secret-field>}} ENV_VAR_FROM_K8S_CONFIGMAP={{kubernetes/<name-space-name>/configmaps/<configmap-name>/<configmap-field>}} ENV_VAR_FROM_AZURE_KEYVAULT={{azure-keyvault/<keyvault-name>/secrets/<secret-name>}}
-
Run the following command to generate an environment file simply run
tenvplate
. Optional arguments are:--src-path
to specify the template file (default.env.template
in the working directory)--dst-path
to specify the destination file (default.env
in the same directory as the template file)
Contributing
To setup the development environment and run linting and testing:
python -m venv .venv
source .venv/Scripts/activate # or .venv/bin/activate on linux
pip install -e .[dev]
poe all
To test the ability to install with:
uv tool install --refresh --force .
pipx install . --force
To build the package: python -m build --wheel
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 Distributions
Built Distribution
Hashes for tenvplate-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78e1567dd176e3689979d46544b768b420cc8be08e619d49a0ae249ee82143e0 |
|
MD5 | f4166f7303dd27671756621f7cf4c269 |
|
BLAKE2b-256 | 0556ba2215a26a62bd1f65307b509d41b42cc0adecd0e7dce5e2122dc5d3087f |