diff --git a/internal/config/config.go b/internal/config/config.go index 42362e28b..48105c1c6 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -600,6 +600,10 @@ func (c *Config) UpdateHub() { // initHub initializes PhotoPrism hub config. func (c *Config) initHub() { + if c.hub != nil { + return + } + c.hub = hub.NewConfig(c.Version(), c.HubConfigFile(), c.serial, c.env, c.UserAgent(), c.options.PartnerID) if err := c.hub.Load(); err == nil { @@ -626,9 +630,7 @@ func (c *Config) initHub() { // Hub returns the PhotoPrism hub config. func (c *Config) Hub() *hub.Config { - if c.hub == nil { - c.initHub() - } + c.initHub() return c.hub } diff --git a/internal/config/settings.go b/internal/config/settings.go index c26fef0df..5d990e90a 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -218,6 +218,10 @@ func (s *Settings) Save(fileName string) error { // initSettings initializes user settings from a config file. func (c *Config) initSettings() { + if c.settings != nil { + return + } + c.settings = NewSettings(c) fileName := c.SettingsFile() @@ -236,9 +240,7 @@ func (c *Config) initSettings() { // Settings returns the current user settings. func (c *Config) Settings() *Settings { - if c.settings == nil { - c.initSettings() - } + c.initSettings() if c.DisablePlaces() { c.settings.Features.Places = false