From 5bab9ac04a9a1e55dd9b7095bf2b789fe50acc0c Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Thu, 5 May 2022 23:25:00 -0700 Subject: [PATCH] make sure we can correctly save the config file if onboarding influx. --- webapp/backend/pkg/config/config.go | 2 ++ webapp/backend/pkg/database/scrutiny_repository.go | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/webapp/backend/pkg/config/config.go b/webapp/backend/pkg/config/config.go index 31243e9..88ab60e 100644 --- a/webapp/backend/pkg/config/config.go +++ b/webapp/backend/pkg/config/config.go @@ -104,6 +104,8 @@ func (c *configuration) ReadConfig(configFilePath string) error { if err != nil { return err } + //make sure that we specify that this is the correct config path (for eventual WriteConfig() calls) + c.SetConfigFile(configFilePath) return c.ValidateConfig() } diff --git a/webapp/backend/pkg/database/scrutiny_repository.go b/webapp/backend/pkg/database/scrutiny_repository.go index c35923f..fb94f62 100644 --- a/webapp/backend/pkg/database/scrutiny_repository.go +++ b/webapp/backend/pkg/database/scrutiny_repository.go @@ -101,8 +101,10 @@ func NewScrutinyRepository(appConfig config.Interface, globalLogger logrus.Field appConfig.Set("web.influxdb.token", *onboardingResponse.Auth.Token) // we should write the config file out here. Ignore failures. - _ = appConfig.WriteConfig() - + err = appConfig.WriteConfig() + if err != nil { + globalLogger.Infof("ignoring error while writing influxdb info to config: %v", err) + } } // Use blocking write client for writes to desired bucket