Skip to content
New issue

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

Multi-pass support; add missing-key option to skip over missing keys without altering the template #2322

Open
loucadufault opened this issue Feb 14, 2025 · 0 comments

Comments

@loucadufault
Copy link

The use case would be to enable workflows which use gomplate to render a template over several passes, perhaps with different datasources at each pass, such that not all keys are available upon the first pass.

E.g.

$ echo 'name: Bob' | gomplate --missing-key skip -i 'Hi {{ .name }} (password: {{ env.Getenv "PASSWORD" }})' -c stdin: -o intermediate.txt
$ PASSWORD=hello123 gomplate -f intermediate.txt

The first command would generate an intermediate template, with the template for the missed key "PASSWORD" unaltered, which would allow a second pass to render it in.

Is this kind of behaviour feasible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant