From 5fb5b9afbe27b3b05c670a98de26bf7844495e97 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 30 Apr 2022 15:56:48 -0700 Subject: [PATCH] if we're completing the InfluxDB setup via automation, attempt to store the token in the config file automatically. --- webapp/backend/pkg/config/interface.go | 1 + webapp/backend/pkg/database/scrutiny_repository.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/webapp/backend/pkg/config/interface.go b/webapp/backend/pkg/config/interface.go index fabe8af..8f0b773 100644 --- a/webapp/backend/pkg/config/interface.go +++ b/webapp/backend/pkg/config/interface.go @@ -9,6 +9,7 @@ import ( type Interface interface { Init() error ReadConfig(configFilePath string) error + WriteConfig() error Set(key string, value interface{}) SetDefault(key string, value interface{}) diff --git a/webapp/backend/pkg/database/scrutiny_repository.go b/webapp/backend/pkg/database/scrutiny_repository.go index 0102771..f442a20 100644 --- a/webapp/backend/pkg/database/scrutiny_repository.go +++ b/webapp/backend/pkg/database/scrutiny_repository.go @@ -99,7 +99,9 @@ func NewScrutinyRepository(appConfig config.Interface, globalLogger logrus.Field } appConfig.Set("web.influxdb.token", *onboardingResponse.Auth.Token) - //todo: determine if we should write the config file out here. + // we should write the config file out here. Ignore failures. + _ = appConfig.WriteConfig() + } // Use blocking write client for writes to desired bucket