tsubst
Substitute environment variables on GO templates
Example - Basic Usage
Given the following "template.yml" file:
job1:
environment: {{.ENV}}
Run this:
$ export ENV=prod
$ tsubst template.yml > prod.yml
$ cat prod.yml
job1:
environment: prod
Example - Conditionals
Given the following "template.yml" file:
server-deployment:
{{if eq .MODE "basic"}}
instances: 1
{{else}}
instances: 3
{{end}}
Run this:
$ export MODE=basic
$ tsubst template.yml > basic.yml
$ cat basic.yml
server-deployment:
instances: 1
For a complete reference on the template syntax and capabilities,
see the GO template library documentation.