Use service.project.domain instead of project-service.domain

This commit is contained in:
tcoupin 2017-03-09 22:27:09 +01:00 committed by Emile Vauge
parent 0a7f9b5a71
commit 5c16860486
No known key found for this signature in database
GPG key ID: D808B4C167352E59
3 changed files with 6 additions and 6 deletions

View file

@ -823,7 +823,7 @@ Labels can be used on containers to override default behaviour:
- `traefik.protocol=https`: override the default `http` protocol
- `traefik.weight=10`: assign this weight to the container
- `traefik.enable=false`: disable this container in Træfɪk
- `traefik.frontend.rule=Host:test.traefik.io`: override the default frontend rule (Default: `Host:{containerName}.{domain}` or `Host:{project_name}-{service}.{domain}` if you are using `docker-compose`).
- `traefik.frontend.rule=Host:test.traefik.io`: override the default frontend rule (Default: `Host:{containerName}.{domain}` or `Host:{service}.{project_name}.{domain}` if you are using `docker-compose`).
- `traefik.frontend.passHostHeader=true`: forward client `Host` header to the backend.
- `traefik.frontend.priority=10`: override default frontend priority
- `traefik.frontend.entryPoints=http,https`: assign this frontend to entry points `http` and `https`. Overrides `defaultEntryPoints`.

View file

@ -526,7 +526,7 @@ func (provider *Docker) getFrontendRule(container dockerData) string {
return label
}
if labels, err := getLabels(container, []string{"com.docker.compose.project", "com.docker.compose.service"}); err == nil {
return "Host:" + provider.getSubDomain(labels["com.docker.compose.project"]+"_"+labels["com.docker.compose.service"]) + "." + provider.Domain
return "Host:" + provider.getSubDomain(labels["com.docker.compose.service"]+"."+labels["com.docker.compose.project"]) + "." + provider.Domain
}
return "Host:" + provider.getSubDomain(container.ServiceName) + "." + provider.Domain
@ -537,7 +537,7 @@ func (provider *Docker) getBackend(container dockerData) string {
return normalize(label)
}
if labels, err := getLabels(container, []string{"com.docker.compose.project", "com.docker.compose.service"}); err == nil {
return normalize(labels["com.docker.compose.project"] + "_" + labels["com.docker.compose.service"])
return normalize(labels["com.docker.compose.service"] + "_" + labels["com.docker.compose.project"])
}
return normalize(container.ServiceName)
}

View file

@ -56,7 +56,7 @@ func TestDockerGetFrontendName(t *testing.T) {
},
},
},
expected: "Host-foo-bar-docker-localhost",
expected: "Host-bar-foo-docker-localhost",
},
{
container: docker.ContainerJSON{
@ -159,7 +159,7 @@ func TestDockerGetFrontendRule(t *testing.T) {
},
},
},
expected: "Host:foo-bar.docker.localhost",
expected: "Host:bar.foo.docker.localhost",
},
{
container: docker.ContainerJSON{
@ -235,7 +235,7 @@ func TestDockerGetBackend(t *testing.T) {
},
},
},
expected: "foo-bar",
expected: "bar-foo",
},
}