diff --git a/pkg/provider/file/file.go b/pkg/provider/file/file.go index 08ee0896d..548f0cbc4 100644 --- a/pkg/provider/file/file.go +++ b/pkg/provider/file/file.go @@ -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 }