Templating configuration files from the shell

Topics: Linux Shell

Shell templating can substitute environment-variable values into configuration files before they are applied.

Templating configuration files on the shell

The envsubst command from the gettext package substitutes placeholders in the form of ${ENVVAR} and dumps the result to STDOUT:

envsubst < k8s.yml | kubectl apply -f -