From 408608d494bc158aaca8ecaed22ef955bdc7aab1 Mon Sep 17 00:00:00 2001 From: Nick Misasi Date: Mon, 25 Mar 2024 15:43:26 -0400 Subject: [PATCH] [CLD-7373] Always overwrite CloudSettings based on service environment when in production (#26581) * Always overwrite CloudSettings based on service environment * Only override the CWSURL, leave CWSAPIURL * Update to allow tests to pass * Undo unintentional changes --- server/public/model/config.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/public/model/config.go b/server/public/model/config.go index c257e092df8..41a33dd5e94 100644 --- a/server/public/model/config.go +++ b/server/public/model/config.go @@ -3015,16 +3015,18 @@ type CloudSettings struct { } func (s *CloudSettings) SetDefaults() { - if s.CWSURL == nil { - switch GetServiceEnvironment() { + serviceEnvironment := GetServiceEnvironment() + if s.CWSURL == nil || serviceEnvironment == ServiceEnvironmentProduction { + switch serviceEnvironment { case ServiceEnvironmentProduction: s.CWSURL = NewString(CloudSettingsDefaultCwsURL) case ServiceEnvironmentTest, ServiceEnvironmentDev: s.CWSURL = NewString(CloudSettingsDefaultCwsURLTest) } } + if s.CWSAPIURL == nil { - switch GetServiceEnvironment() { + switch serviceEnvironment { case ServiceEnvironmentProduction: s.CWSAPIURL = NewString(CloudSettingsDefaultCwsAPIURL) case ServiceEnvironmentTest, ServiceEnvironmentDev: