Htpasswd in traefik.toml

Hey all! I’ve written a guide on installing Traefik together with Docker. It also includes adding the dashboard/API with Basic Auth protection. Previously I had the user/password as a label in docker-compose but moved it to traefik.toml. My question is whether I still need to escape $ when doing that or if it’s only applicable in yaml-files? I do escape at the moment and it seems to work but...

Hi @joenas !

You are probably hitting a docker-compose variable substitution in this case, more info here.

On that case you did right by adding a $ before the value.

You can also try passing a file directly to the configuration, like:
usersFile = "/path/to/.htdigest" as described in this section of the docs.

Keep in mind that setting any sensitive information in config files is never a good idea, unless it's just for education as seems to be your case. But if you want to set these types of values in a config I would recommend using environment variables and then doing some variable substitution yourself using tools like envsubst ( GNU gettext-runtime).