tplenv
tplenv renders {{...}} placeholders in a template file.
{{VARNAME}}reads from environment variables (or fromenvironment.VARNAMEwith--value-file-only).{{ .Values.key }}reads from a YAML values file.
Install
To install tplenv on your computer, just run:
Building
Binary path:
Help
Show CLI usage:
Usage
Options:
-f, --file <PATH>: input template file (required)--values <PATH>: values YAML file (default:Values.yaml)-o, --output <PATH>: output file (-or omitted means stdout)-v, --verbose: print substitutions to stderr--create-values-file: ask for missing.Values.*placeholders and write/update the values file--force: only valid with--create-values-file; asks for all.Values.*placeholders and uses existing values as prompt defaults--value-file-only: resolve{{VARNAME}}fromenvironment.VARNAMEin the values file (do not read OS environment variables)-h, --help: print help--version: print version
Examples
Render using environment variables and values file:
Create/update only missing values in Values.yaml, then render:
Ask for all values found in the template and prefill from existing file values:
Resolve {{VARNAME}} from the values file:
With --value-file-only, interactive mode also manages missing environment.* keys:
More runnable examples are in examples/README.md.
That includes a --value-file-only --create-values-file --force interactive example with defaults.
Tests
Run unit tests:
Nix (Deterministic Build)
This repo now includes a flake-based build:
/Users/christoffetzer/Library/Mobile Documents/com~apple~CloudDocs/GIT/scontainug/tplenv/flake.nix/Users/christoffetzer/Library/Mobile Documents/com~apple~CloudDocs/GIT/scontainug/tplenv/default.nix
Build with Nix:
Enter development shell:
For deterministic builds across machines, commit flake.lock to the repo.
If it does not exist yet, generate it once with: