1
0
Fork 0

Add marathon label to configure basic auth, similar to docker and rancher providers

This commit is contained in:
Matt Christiansen 2017-06-27 17:22:17 -07:00 committed by Ludovic Fernandez
parent c31b4c55c2
commit 4dfbb6d489
4 changed files with 62 additions and 5 deletions

View file

@ -163,6 +163,7 @@ func (p *Provider) loadMarathonConfig() *types.Configuration {
"hasHealthCheckLabels": p.hasHealthCheckLabels,
"getHealthCheckPath": p.getHealthCheckPath,
"getHealthCheckInterval": p.getHealthCheckInterval,
"getBasicAuth": p.getBasicAuth,
}
applications, err := p.marathonClient.Applications(nil)
@ -485,6 +486,14 @@ func (p *Provider) getHealthCheckInterval(application marathon.Application) stri
return ""
}
func (p *Provider) getBasicAuth(application marathon.Application) []string {
if basicAuth, ok := p.getLabel(application, "traefik.frontend.auth.basic"); ok {
return strings.Split(basicAuth, ",")
}
return []string{}
}
func processPorts(application marathon.Application, task marathon.Task) (int, error) {
if portLabel, ok := (*application.Labels)[labelPort]; ok {
port, err := strconv.Atoi(portLabel)