feat: handle missing config file gracefully with a warning

Signed-off-by: Dmytro Bondar <git@bonddim.com>
This commit is contained in:
Dmytro Bondar 2024-12-05 12:16:05 +01:00
parent 81ff0cde60
commit 69d5d569ab
No known key found for this signature in database
GPG Key ID: C123CD37BBED8BB7

View File

@ -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)
}