Using a different templating engine in Consul Template

This is a question related to Consul Template and hence Nomad’s template stanza.

I have been wondering if it would be a fair request to ask for another templating engine than the default Go templating engine?

That is, let the existing templating engine be, but by using extra parameters, be able to use an altogether different template engine.

I feel the Go templating engine is not very intuitive when compared to Mustache or Jinja.

Could there be a Golang implementation of something equivalent to Jinja2 (pongo2) be added to CT (or Nomad)?

Shantanu Gadgil

1 Like

Hi @shantanugadgil,

The consul-template library is maintained by a separate team to the Nomad engineering team. I would therefore suggest raising this request against the repository.

jrasell and the Nomad team

1 Like

Hahaha … :laughing:

Hey shantanugadgil, thanks for the interest and request.

I am the current maintainer of consul-template and am afraid I agree with Mitchell. Using the templating functionality from Go’s standard library has to many benefits to make supporting an alternative worthwhile.

Also, as Seth mentioned, any extensions to the template functions that would help your case are welcome. They are very easy to add and I’m happy to look into it or review a PR with the added functionality. Please file any such requests in github.


Thanks for responding, though I do not mind whether it is templating engineA or templating engineB, I am just a user of the functionality.

It’s just that the Go templating syntax is not intuitive, when compared to Jinja2.

One could of course counter argue that it is could be just a matter of “what one learned first” and hence the question from my side (and I am OK with such) :slight_smile:

Regarding submitting a PR, I have to confess that I do not have the Go skills to rework the Go templating to make it behave like Jinja2 :beginner: