Is it yet impossible to specify ACME resolver email as an environment variable?

Hi there

Times ago I was stuck with the certificatesResolvers being part of the static configuration, hence unable to take environment variable, hence the email was written in stone

certificatesResolvers:
  letsencrypt: # random key name
    acme:
      email: "me@company.cloud"
      storage: "/etc/traefik/acme.json"
      httpChallenge:
        entryPoint: "web"

Is there a way now to workaround the hardcoded email ? Without using a command override --certificateResolvers.letsencrypt.acme.email=$(ACME_EMAIL), I guess it's possible, but I want to keep the configuration in file ?

hello @rrrrrrrrrr

Thanks for using Traefik.

Here are all available environment variables that might be configured.

The ACME email address can be set by: TRAEFIK_CERTIFICATESRESOLVERS_<NAME>_ACME_EMAIL

Please also note that Traefik can be configured through:

  • static configuration file
  • CLI arguments
  • environments variables

Those methods are mutually exclusive which means you can use only one at the same time.

As you said, they are mutually exclusive. I'm relying on files. The resolvers stuff goes in the static, which can't interpolate env variable as far as I know

Exactly. This is the same problem with TLS domains and wildcards, which is supposed to be a very simple use-case for traefik.

As a user, I would like to use configuration files exclusively, without hardcoding emails, or domains.

  • When using wildcards certs via DNS challenge, you need to hardcode the email, if you are using static configuration (traefik.yml), because certificatesresolvers has to stay in static configuration.
  • When using tls domains (main and sans), you need to hardcode the domain, as these are also in static configuration. You can get away with adding them to each individual router instead the global entrypoints, but then you have to duplicate them on every router, because you can't use env vars in static configuration.

Yes you can pollute your docker-compose file, but the initial goal was to just use static and dynamic configuration. The second bullet point above is somewhat solvable, the first one is not unless you want to shove the entirety of your static traefik.yml file into your docker-compose file instead. :man_facepalming:

-- Edit: Oh and to add, because configuration is mutually exclusive, AFAIK you can't have the static configuration (traefik.yml file) and a single environment variable used for that pesky email address, either.