1package marathon 2 3import ( 4 "math" 5 6 "github.com/gambol99/go-marathon" 7 "github.com/traefik/traefik/v2/pkg/config/label" 8) 9 10type configuration struct { 11 Enable bool 12 Marathon specificConfiguration 13} 14 15type specificConfiguration struct { 16 IPAddressIdx int 17} 18 19func (p *Provider) getConfiguration(app marathon.Application) (configuration, error) { 20 labels := stringValueMap(app.Labels) 21 22 conf := configuration{ 23 Enable: p.ExposedByDefault, 24 Marathon: specificConfiguration{ 25 IPAddressIdx: math.MinInt32, 26 }, 27 } 28 29 err := label.Decode(labels, &conf, "traefik.marathon.", "traefik.enable") 30 if err != nil { 31 return configuration{}, err 32 } 33 34 return conf, nil 35} 36 37func stringValueMap(mp *map[string]string) map[string]string { 38 if mp != nil { 39 return *mp 40 } 41 return make(map[string]string) 42} 43