common/templates/env

20 lines
481 B
HCL

[[- /*
# vim: syntax=hcl
# Note: for compatibility, we take env either from .env (when passing the whole context to the template)
# or from . (when only .env is passed as context)
*/ -]]
[[- $env := dict ]]
[[- if and (has . "env") (isKind "map" .env) ]]
[[- $env = .env ]]
[[- else ]]
[[- $env = . ]]
[[- end -]]
[[- range $k, $v := $env ]]
[[- if isKind "number" $v ]]
[[ $k ]] = [[ $v ]]
[[- else ]]
[[ $k ]] = [[ $v | toJSON ]]
[[- end ]]
[[- end ]]