my .env file in the traefik-stack folder looks something like:
TRAEFIKADMINCREDS='user:hashedpass'
EMAILFORRESOLVER='user@email.com'
DOMAIN='example.com'
CROWDSEC_BOUNCER_API_KEY='foo'
In my docker-compose.yml I know I can simply...
- traefik.http.routers.traefik-https.rule=Host(`hostname.${DOMAIN}`)```
and the above works... I have also attempted to declare environment variables in docker-compose.yml like this:
environment:
- DOMAIN=${DOMAIN}
- CROWDSEC_BOUNCER_API_KEY=${CROWDSEC_BOUNCER_API_KEY}
In the above example, I'm concerned that perhaps the declared variables being the the same is an issue? ie: MYDOMAIN=${DOMAIN} better than DOMAIN=${DOMAIN} ?
I have not been able to get .env variables working in either my static (traefik.yml) or dynamic configs (dynamic_config.yml).
In my static (traefik.yml):
acme:
email: {{ env "EMAILFORRESOLVER" }}
# email: {{ env "emailforresolver" }}
# email: {env "emailforresolver"}
In my dynamic config (dynamic_config.yml) something like:
proxmox-https:
rule: "Host(`hostname.{{ env "DOMAIN" }}`)"
# rule: "Host(`hostname.{{ env "domain" }}`)"
# rule: "Host(`hostname.{ env "DOMAIN" }`)"
# rule: "Host(`hostname.{ env "domain" }`)"
I'm not sure what I'm doing wrong, but I'm beating my head agains a wall trying to get .env variables in my static and dynamic config files. What is the correct way to format and method to insert env variables to these files? Also, does v3 do this different from v2? Please help! I've attempted read the documentation on this but I'm quite confused about it. Perhaps when I get this working I have a question about secrets too.