New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration through environment #7
Comments
@andyshinn cool idea yeah, it's kinda in our head to add a possibility to configure the docker image in some way 😉 |
Hi |
Oh yea, Viper looks like a cool solution. Would definitely help! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
+1 Does the configuration file currently inject environment variables? |
Could you use flags instead? |
Sure I can add flags for all config items instead of using ENV vars. |
Flags are already here in fact :) |
For all settings found in config file? Is there a flag to disable the
|
Flags still don't give the same advantage as environment variables in a container runtime for passing secrets and dynamic configuration |
Right, what do you mean by dynamic configuration? |
Anything environment specific where traefik should find itself scheduled. Are all config items currently flags and can a config file requirement be
|
@stongo: almost everything can be set using flags. |
Great to hear it's on the roadmap! Thanks for the advice |
This comment has been minimized.
This comment has been minimized.
Key use cases for viper et al for me I think would be doing things like:
looking at trying to do this atm, and it looks quite difficult as is. Not sure if consul/etcd stores support key/cert changes, and ACME looks like config only from what I can see - or perhaps I've just not seen the right example yet. So keen to see this in the roadmap. Where is the roadmap, btw? 😉 |
As I understand we have switched to https://github.com/containous/staert, I think this issue could now be closed? right @emilevauge? |
So far, environment variables are not handled by https://github.com/containous/staert. But it could be a nice improvement ... WDYT @emilevauge ? |
^ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
See traefik#7 rules: - environment variables starting with `TRAEFIK_` will be considered - environment variables must be named after the traefik command line option, replacing any dots `.` with underscores `_` examples: | | | |-------------------------------------------------------------------|----------------------------------------------| | `TRAEFIK_DEBUG= /docker-entrypoint.sh` | `/traefik --debug` | | `TRAEFIK_WEB= /docker-entrypoint.sh` | `/traefik --web` | | `TRAEFIK_DOCKER_DOMAIN=docker.localhost /docker-entrypoint.sh` | `/traefik --docker.domain=docker.localhost | | `TRAEFIK_LOGLEVEL=DEBUG /docker-entrypoint.sh` | `/traefik --loglevel=DEBUG` | | `TRAEFIK_DOCKER_EXPOSEDBYDEFAULT=false /docker-entrypoint.sh` | `/traefik --docker.exposedbydefault=false |
This comment has been minimized.
This comment has been minimized.
I felt the same, but then I discovered that every option you can set in the toml file, you can set it by a CLI option. It's not so beautiful, but after all it lets you basically the same benefits as those you wanted from the env variables. |
This comment has been minimized.
This comment has been minimized.
An example found digging in the docs, using flags in case anyone has trouble finding it. https://docs.traefik.io/v1.7/user-guide/cluster-docker-consul/ version: "3"
services:
traefik:
image: traefik:1.7
command:
- "--api"
- "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entrypoints=Name:https Address::443 TLS"
- "--defaultentrypoints=http,https"
- "--acme"
- "--acme.storage=/etc/traefik/acme/acme.json"
- "--acme.entryPoint=https"
- "--acme.httpChallenge.entryPoint=http"
- "--acme.onHostRule=true"
- "--acme.onDemand=false"
- "--acme.email=contact@mydomain.ca"
- "--docker"
- "--docker.swarmMode"
- "--docker.domain=mydomain.ca"
- "--docker.watch"
|
What happens if I just want to replace acme.email for example and keep using the rest of the toml file?. Can I just set --acme.email and it will override the toml? |
Closed by #4935. |
Any plans to do configuration through environment? I'd love the ability to configure with something like:
The text was updated successfully, but these errors were encountered: