Skip to content

Utility to generate .env files from templates by fetching data to remote keyvaults

License

Notifications You must be signed in to change notification settings

cctan777/tenvplate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Utility to generate .env files from templates by fetching data to remote keyvaults

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%