Skip to main content

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

  1. 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 or pipx install tenvplate

  2. 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>}}
    
  3. 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

See the CONTRIBUTING.md file for more information.

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

tenvplate-0.0.4.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

tenvplate-0.0.4-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file tenvplate-0.0.4.tar.gz.

File metadata

  • Download URL: tenvplate-0.0.4.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tenvplate-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f8f49450d7ab038ecae47c632b866b8508014d2997472494ef525af46baf1e45
MD5 4a5a36b91cf9e3264006bc7985d51d2d
BLAKE2b-256 461a430b8100f9540dc5801b6d59fa469ad2a7e3a4bb04cfb87ff3c4e0391d58

See more details on using hashes here.

File details

Details for the file tenvplate-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: tenvplate-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tenvplate-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dddaa732f8315afa62eef41347c15eb981ceed9f2e659932c6df0df7ae80976e
MD5 5e002dacb1b54dc140639954328db464
BLAKE2b-256 eb9ef3123976beae5cf32760ec2a97e8f8a963f5afd78959107292611cf1a537

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page