-
Notifications
You must be signed in to change notification settings - Fork 781
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
Add sprig function support #1206
Comments
please, pretty please |
This would be amazing. Sprig has saved me a lot of trouble with helm charts, and would be great to have in consul-template as well! |
need this |
consul-template/template/template.go Line 223 in 34cd324
might be collisions, might have to use a prefix name in the mappings: http://masterminds.github.io/sprig/ |
I think several of us would appreciate this PR picked up: #1312 |
#1312 was merged! |
The problem is compatibility. Sprig 3 breaks compatibility with Sprig 2 which is what was merged. We could do a backwards incompatible update, but I don't like to do that if possible. Adding a whole other sprig3* namespace is not really appealing either. I'm going to think about the best solution. If you'd like to keep this more on the radar, maybe file a separate feature request issues. Maybe others will have an better idea on integrating sprig3 or at least that will be a place to track interest and priority. Thanks. |
Thanks for explaining. Didn't know the switch to I'm starting to think I'm better off trying to use hcat instead to build something more custom. (Edit: Or just hack something together in Python + Consul2 + Jinja2.) |
Consul-template will be ported to use hcat as soon as I have the time. That was always the plan. After that I was considering a v2 template library that would allow more modularity, allow for versioning and give template writers more flexibility... but that is mere speculation at this point. Lots to do to get there. I also maintain hcat and would be happy to help with any usage. Be warned though that there are a couple more API breaking changes in the plans (not huge, but will require updates) before we hit a stable, semantic versioned, 1.0. |
I don't think it is that big of a change, but they do list a few backwards incompatibilities (they list 1 breaking change for |
Yeah, that's what I thought it was for, and I'm aware it's unstable, that's fine by me. My use case is that I have Consul service which represent backends/upstreams for an Nginx Reverse proxy, for which the config is generated using I was hoping to use dicts and |
There might be a way to do that with CT, I've seen some pretty crazy setups. You could ask on the discuss forum where others who are much better at the templates than I am (shout-out to @blake ) could see it and have a chance to respond. Just a thought. |
Discuss forum I mentioned... https://discuss.hashicorp.com/tags/c/consul/29/consul-template |
Will do, thanks. |
@jakubgs, I shared a template earlier today sounds like it does some of what you're looking for. Take a look and let me know if this meets your needs. https://discuss.hashicorp.com/t/consul-template-nginx-vhost/4425/2?u=blake |
Thanks @blake, interesting. I will have to read into it and do some tests, it does appear to use some elements of dark magic. |
With very minimal modifications I managed to get your example working for my own setup!. Thanks a bunch @blake, really cool stuff. And now I can even filter by just tags, which is what I wanted from the start. |
Please consider adding sprig go templating function support, its used in helm etc and would be a great additional of capabilities into consul-template
https://github.com/Masterminds/sprig
The text was updated successfully, but these errors were encountered: