2020-07-15 14:28:04 +00:00
|
|
|
package ecs
|
|
|
|
|
|
|
|
import (
|
2020-09-16 13:46:04 +00:00
|
|
|
"github.com/traefik/traefik/v2/pkg/config/label"
|
2020-07-15 14:28:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// configuration Contains information from the labels that are globals (not related to the dynamic configuration) or specific to the provider.
|
|
|
|
type configuration struct {
|
|
|
|
Enable bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Provider) getConfiguration(instance ecsInstance) (configuration, error) {
|
|
|
|
conf := configuration{
|
|
|
|
Enable: p.ExposedByDefault,
|
|
|
|
}
|
|
|
|
|
|
|
|
err := label.Decode(instance.Labels, &conf, "traefik.ecs.", "traefik.enable")
|
|
|
|
if err != nil {
|
|
|
|
return configuration{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return conf, nil
|
|
|
|
}
|