1
0
Fork 0

Add Basic Auth per Frontend for Rancher & Docker Dynamic Provider

This commit is contained in:
Manuel Laufenberg 2017-04-19 11:14:05 +02:00
parent 4e0f131fcd
commit 8a892b21e1
11 changed files with 78 additions and 2 deletions

View file

@ -88,6 +88,13 @@ func (p *Provider) getFrontendRule(service rancherData) string {
return "Host:" + strings.ToLower(strings.Replace(service.Name, "/", ".", -1)) + "." + p.Domain
}
func (p *Provider) getBasicAuth(service rancherData) []string {
if basicAuth, err := getServiceLabel(service, "traefik.frontend.auth.basic"); err == nil {
return strings.Split(basicAuth, ",")
}
return []string{}
}
func (p *Provider) getFrontendName(service rancherData) string {
// Replace '.' with '-' in quoted keys because of this issue https://github.com/BurntSushi/toml/issues/78
return provider.Normalize(p.getFrontendRule(service))
@ -411,6 +418,7 @@ func (p *Provider) loadRancherConfig(services []rancherData) *types.Configuratio
"getPassHostHeader": p.getPassHostHeader,
"getPriority": p.getPriority,
"getEntryPoints": p.getEntryPoints,
"getBasicAuth": p.getBasicAuth,
"getFrontendRule": p.getFrontendRule,
"hasCircuitBreakerLabel": p.hasCircuitBreakerLabel,
"getCircuitBreakerExpression": p.getCircuitBreakerExpression,