sprig
sprig copied to clipboard
How about a function toBool?
Currently, I have to do something like:
{{ not ( not (env "CODESPACES") ) }}
# or
{{ env "CODESPACES" | not | not }}
To convert a string to boolean.
I would be good if we had another function for the conversions such as toBool.
This would be really useful for helm-charts too, a bit surprised it's not already included in sprig as there are all other conversions.
Hi. I forked the sprig and improve it with some useful functions. Your suggestion is implemented in my project. You can replace sprig to thixo as is. Thixo doesn't have any breaking changes.
not | not is not a possible solution if you are trying to support old helm versions like 3.5-ish.
"false" | not | not returns true 😓.
My solution is then to use eq "false" other_value instead…
argocd generattor has some limitation, possibly because of this boolean feature: https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/GoTemplate/#limitations