docker domain

This commit is contained in:
emile 2015-09-09 17:10:43 +02:00
parent 730fbfe9c5
commit c5a91e7d22
3 changed files with 6 additions and 2 deletions

View file

@ -34,6 +34,7 @@ type DockerProvider struct {
Watch bool Watch bool
Endpoint string Endpoint string
dockerClient *docker.Client dockerClient *docker.Client
Domain string
} }
func (provider *DockerProvider) Provide(configurationChan chan <- *Configuration) { func (provider *DockerProvider) Provide(configurationChan chan <- *Configuration) {
@ -70,10 +71,12 @@ func (provider *DockerProvider) loadDockerConfig() *Configuration {
templateObjects := struct { templateObjects := struct {
Containers []docker.Container Containers []docker.Container
Hosts map[string][]docker.Container Hosts map[string][]docker.Container
Domain string
}{ }{
containersInspected, containersInspected,
hosts, hosts,
provider.Domain,
} }
gtf.Inject(DockerFuncMap) gtf.Inject(DockerFuncMap)
tmpl, err := template.New("docker.tmpl").Funcs(DockerFuncMap).ParseFiles("docker.tmpl") tmpl, err := template.New("docker.tmpl").Funcs(DockerFuncMap).ParseFiles("docker.tmpl")

View file

@ -8,5 +8,5 @@
backends = [{{range $container := $containers}}"backend-{{getBackend $container}}",{{end}}] backends = [{{range $container := $containers}}"backend-{{getBackend $container}}",{{end}}]
[routes.route-{{$host}}.rules.rule-host-{{$host}}] [routes.route-{{$host}}.rules.rule-host-{{$host}}]
category = "Host" category = "Host"
value = "{{$host}}.zenika.fr" value = "{{$host}}.{{$.Domain}}"
{{end}} {{end}}

View file

@ -1,6 +1,7 @@
[docker] [docker]
endpoint = "unix:///var/run/docker.sock" endpoint = "unix:///var/run/docker.sock"
watch = true watch = true
domain = "toto.fr"
[web] [web]
address = ":8010" address = ":8010"