From 0ea24e313d6af7ba1186cca1e21e8214be1a7ad4 Mon Sep 17 00:00:00 2001 From: Dmytro Bondar Date: Tue, 10 Dec 2024 15:17:31 +0100 Subject: [PATCH] feat: handle missing config file gracefully with a warning (#331) Signed-off-by: Dmytro Bondar --- internal/config/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index 607e8c0..f3234ea 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -159,6 +159,10 @@ func GetConfig() (*Config, error) { func loadConfigFile(cfg any, filename string) error { data, err := envsubst.ReadFile(filename) if err != nil { + if os.IsNotExist(err) { + logrus.Warnf("Config file %s not found, using default values", filename) + return nil + } return fmt.Errorf("envsubst error: %v", err) }