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

[ENHANCEMENT] LINE_IN_FILE as hook for templates #694

Open
tobiastom opened this issue Apr 18, 2024 · 0 comments
Open

[ENHANCEMENT] LINE_IN_FILE as hook for templates #694

tobiastom opened this issue Apr 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@tobiastom
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Sometimes one would like to write dynamic content to a file. This works with the render hook inside templates.
Unfortunately some files need to be merged from different templates. My concrete example is the domains.txt from dehydrated.

I'd like to create a template for each hostname I configure in Nginx. When I use RENDER to render this file with the HOSTNAME argument, the previous content is replaced.

Describe the solution you'd like
I'd like to use something like this inside a template:

LINE_IN_FILE ${HOSTNAME} /usr/local/etc/dehydrated/domains.txt

This would check if the line exists inside the file, and if it doesn't appends it.

Describe alternatives you've considered
I can run a custom command inside the jail, which works, but is not very convenient:

CMD grep -qxF ${HOSTNAME} /usr/local/etc/dehydrated/domains.txt || echo ${HOSTNAME} >> /usr/local/etc/dehydrated/domains.txt
@tobiastom tobiastom added the enhancement New feature or request label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant