Since I need to configure multiple domains, I would like to define the list of these domains in an environment variable.
According to the routers section of the documentation, we should use this format:
Host(`example.com`, ...)
Is there a recommended way to populate this expected list from an environment variable (I use this configuration in a Docker Compose file)?
Since:
To set the value of a rule, use backticks ` or escaped double-quotes ".
I'd like to mention the following can't work with Host(${DOMAINS}) because the domains contained in backticks are interpreted as commands:
$ export DOMAINS="`example.com`, `example2.com`"
zsh: command not found: example.com
zsh: command not found: example2.com
The following format works with export:
$ export DOMAINS="\"example.com\", \"example2.com\""
$ echo $DOMAINS
"example.com", "example2.com"
But from an .env file with DOMAINS="\"example.com\", \"example2.com\"", I get in Traefik:
Cannot issue for \"\\\"example.com\\\", \\\"example2.com\\\"\": Domain name contains an invalid character"