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

Using sprig with confd #770

Open
jcheroske opened this issue Jan 25, 2019 · 2 comments
Open

Using sprig with confd #770

jcheroske opened this issue Jan 25, 2019 · 2 comments

Comments

@jcheroske
Copy link

Is there a straightforward way to have the sprig library available to my templates?

@drauschenbach
Copy link

drauschenbach commented Jun 20, 2020

Sprig would provide some welcomed relief. There are a number of problems that can't presently be solved in confd because it is not yet based on Go 1.11 Templates, and therefore cannot perform variable replacement, to achieve things such as string contains, array contains, etc.

{{$arrayContainsThisHost := false}}
{{range $host := getvs "/my/keys/hosts/*"}}
  {{if eq $host (getenv "HOSTNAME")}}
    {{$arrayContainsThisHost = true}}  <== requires Go 1.11
  {{end}}
{{end}}

{{if eq $arrayContainsThisHost false}}
...

@drauschenbach
Copy link

Sprig also makes sense here because it's included in Helm (for Kubernetes).

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

2 participants