make file provider more resilient wrt first configuration
Co-authored-by: Romain <rtribotte@users.noreply.github.com> Co-authored-by: Tom Moulard <tom.moulard@traefik.io>
This commit is contained in:
parent
d97d3a6726
commit
da93dab828
1 changed files with 9 additions and 5 deletions
|
@ -46,11 +46,6 @@ func (p *Provider) Init() error {
|
|||
// Provide allows the file provider to provide configurations to traefik
|
||||
// using the given configuration channel.
|
||||
func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error {
|
||||
configuration, err := p.BuildConfiguration()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if p.Watch {
|
||||
var watchItem string
|
||||
|
||||
|
@ -68,6 +63,15 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||
}
|
||||
}
|
||||
|
||||
configuration, err := p.BuildConfiguration()
|
||||
if err != nil {
|
||||
if p.Watch {
|
||||
log.WithoutContext().WithField(log.ProviderName, providerName).Errorf("Error while building configuration (for the first time): %v", err)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
sendConfigToChannel(configurationChan, configuration)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue