From 506ded3ad4e2bc20cf78c8fe3ef7c16c6d248ef7 Mon Sep 17 00:00:00 2001 From: Umputun Date: Sat, 28 Aug 2021 12:25:07 -0500 Subject: [PATCH] add a warning on missing configuration file for file provider --- app/discovery/provider/file.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/discovery/provider/file.go b/app/discovery/provider/file.go index 43799ce..41fa485 100644 --- a/app/discovery/provider/file.go +++ b/app/discovery/provider/file.go @@ -35,6 +35,15 @@ func (d *File) Events(ctx context.Context) <-chan discovery.ProviderID { } } + // check once if config file in place and it is file for real and not a directory + fi, err := os.Stat(d.FileName) + if err != nil { + log.Printf("[WARN] configuration file %s not found", d.FileName) + } + if err == nil && fi.IsDir() { + log.Printf("[WARN] %s is directory but configuration file expected", d.FileName) + } + go func() { tk := time.NewTicker(d.CheckInterval) lastModif := time.Time{}