We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using .Env within range produces the following error:
.Env
panic: template: template:19:25: executing "template" at <.Env>: map has no entry for key "Env"
Example:
{{ range (datasource "gomplate").foobar }} {{ .Env.FOOBAR }} {{ end }}
The text was updated successfully, but these errors were encountered:
Ah. yep. This is because the meaning of . changes within range. Probably the simplest way to resolve this is by using getenv instead of .Env:
.
range
getenv
{{ range (datasource "gomplate").foobar }} {{ getenv "FOOBAR" }} {{ end }}
Sorry, something went wrong.
Yes, that's what I've done. But I would have liked the fail-feature in case a variable is not set :)
@estahn ah - well another option could be something like:
{{ $root := . }} {{ range (datasource "gomplate").foobar }} {{ $root.Env.FOOBAR }} {{ end }}
Hope that helps!
No branches or pull requests
Using
.Env
within range produces the following error:Example:
The text was updated successfully, but these errors were encountered: