1
0
Fork 0

Create init method on provider interface

This commit is contained in:
SALLEYRON Julien 2018-07-11 09:08:03 +02:00 committed by Traefiker Bot
parent b2a57ca1f3
commit 027093a5a5
52 changed files with 2760 additions and 131 deletions

View file

@ -89,18 +89,27 @@ func (a nodeSorter) Less(i int, j int) bool {
return lEntry.Service.Port < rEntry.Service.Port
}
// Provide allows the consul catalog provider to provide configurations to traefik
// using the given configuration channel.
func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {
// Init the provider
func (p *Provider) Init(constraints types.Constraints) error {
err := p.BaseProvider.Init(constraints)
if err != nil {
return err
}
client, err := p.createClient()
if err != nil {
return err
}
p.client = client
p.Constraints = append(p.Constraints, constraints...)
p.setupFrontEndRuleTemplate()
return nil
}
// Provide allows the consul catalog provider to provide configurations to traefik
// using the given configuration channel.
func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool) error {
pool.Go(func(stop chan bool) {
notify := func(err error, time time.Duration) {
log.Errorf("Consul connection error %+v, retrying in %s", err, time)