'traefik.yml use environment variables as address/port
I'd like to use dynamic enviroment variables to configure the entryPoints of my traefik.yml file. Currently the entryPoint configuration looks like this
http:
address: ":80"
forwardedHeaders:
insecure: true
https:
address: ":443"
forwardedHeaders:
insecure: true
What I'd like to do is use environment variables instead of static 80 & 443 ports. It should look something like this:
http:
address: ":${HTTP_PORT}"
forwardedHeaders:
insecure: true
https:
address: ":${HTTPS_PORT}"
forwardedHeaders:
insecure: true
Unfortunately when trying to run the Traefik container with Entrypoint configuration like this I get the error message command traefik error: yaml: line xx: did not find expected key
I also tried other conventions to use environment variable like {{ env "HTTP_PORT" }} and also escaped the quotes in all kinds of ways.
The only posts that I've found that would have seemed to solve my problem were here and here but that also didn't solve the issue.
The last approach I've tried was outsource that configuration into a entrypoints.yml and include it with the file: keyword as it seems that the traefik.yml file is static.
None of these methods seemed to work.
And what I'd like to avoid is using envsubst. Please advise.
Greetings
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
