From b3abe6840ae3e12eaa47c6dda88778a1697b7e09 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 4 Dec 2020 12:15:59 +0100 Subject: [PATCH] Config: Create settings.yml if it doesn't exist --- internal/config/settings.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/config/settings.go b/internal/config/settings.go index 74c9e42bb..75e09a766 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -151,18 +151,20 @@ func (s *Settings) Save(fileName string) error { return err } - s.Propagate() - return nil } // initSettings initializes user settings from a config file. func (c *Config) initSettings() { c.settings = NewSettings() - p := c.SettingsFile() + fileName := c.SettingsFile() - if err := c.settings.Load(p); err != nil { - log.Debugln(err) + if err := c.settings.Load(fileName); err == nil { + log.Debugf("config: loaded settings from %s ", fileName) + } else if err := c.settings.Save(fileName); err != nil { + log.Errorf("failed creating %s: %s", fileName, err) + } else { + log.Debugf("config: created %s ", fileName) } i18n.SetDir(c.LocalesPath())