Dynamic configuration templates from a config file

Hello everyone ...

I am trying to mimic the behavior of our fairly Kubernetes Istio/Gloo Mesh ingress traffic policies for local development. What I mean by that is ...

  • As a developer I check out a project "local setup"
  • Then running it, it starts traefik with all APIs and frontends mounted on localhost (so all the services are on the same URL path as they would be on prod)
  • By default, all endpoints are pointing towards the integration environment (running on Kubernetes)

Now what I would like to achieve is that there is a config file where I can define overrides in the traefik config. So for example, I want to develop a frontend feature ... so I configure it that /content is pointing to localhost:3000 where I have my React development build running. My frontend needs an in-development version of an API, so I run that locally and configure /api/content to point to it.

Now I did see the part about templating for file based configs ... but it only uses the Golang templating stuff to eg. iterate over a numeric range. What I am after is that I can define a central struct (= the config file) which is then passed into my dynamic files. That would allow me to implement the overrides.

Golang templating and sprig don't seem to allow me reading a file as a part of the template, I guess that needs to be done in Go. Of course I don't want to recompile Traefik but use the standard build

Is there any way to get this? Only way I saw so far would be env vars, but that's not really having a central config file

Bests & thanks