From 2efb574d3d815d9e90dd38ff7d6a2b841ccc6f21 Mon Sep 17 00:00:00 2001 From: Doug Lauder Date: Thu, 1 Jun 2023 20:19:40 -0400 Subject: [PATCH] Temporarily let AdvancedLoggingConfig take precedence over AdvancedLoggingJSON (#23578) * Temporarily let AdvancedLoggingConfig take precedence over AdvancedLoggingJSON --- server/public/model/config.go | 40 ++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/server/public/model/config.go b/server/public/model/config.go index 0df9ae8bdd2..6609c593b6b 100644 --- a/server/public/model/config.go +++ b/server/public/model/config.go @@ -1344,18 +1344,23 @@ func (s *LogSettings) SetDefaults() { s.AdvancedLoggingJSON = []byte("{}") } } - s.AdvancedLoggingConfig = nil + // temporarily let AdvancedLoggingConfig take precedence. + if s.AdvancedLoggingConfig == nil { + s.AdvancedLoggingConfig = NewString("") + } + //s.AdvancedLoggingConfig = nil } // GetAdvancedLoggingConfig returns the advanced logging config as a []byte. // AdvancedLoggingJSON takes precident over the deprecated AdvancedLoggingConfig. func (s *LogSettings) GetAdvancedLoggingConfig() []byte { - if !utils.IsEmptyJSON(s.AdvancedLoggingJSON) { - return s.AdvancedLoggingJSON - } + // temporarily let AdvancedLoggingConfig take precedence. if s.AdvancedLoggingConfig != nil && !utils.IsEmptyJSON([]byte(*s.AdvancedLoggingConfig)) { return []byte(*s.AdvancedLoggingConfig) } + if !utils.IsEmptyJSON(s.AdvancedLoggingJSON) { + return s.AdvancedLoggingJSON + } return []byte("{}") } @@ -1408,18 +1413,24 @@ func (s *ExperimentalAuditSettings) SetDefaults() { s.AdvancedLoggingJSON = []byte("{}") } } - s.AdvancedLoggingConfig = nil + + // temporarily let AdvancedLoggingConfig take precedence. + if s.AdvancedLoggingConfig == nil { + s.AdvancedLoggingConfig = NewString("") + } + //s.AdvancedLoggingConfig = nil } // GetAdvancedLoggingConfig returns the advanced logging config as a []byte. // AdvancedLoggingJSON takes precident over the deprecated AdvancedLoggingConfig. func (s *ExperimentalAuditSettings) GetAdvancedLoggingConfig() []byte { - if !utils.IsEmptyJSON(s.AdvancedLoggingJSON) { - return s.AdvancedLoggingJSON - } + // temporarily let AdvancedLoggingConfig take precedence. if s.AdvancedLoggingConfig != nil && !utils.IsEmptyJSON([]byte(*s.AdvancedLoggingConfig)) { return []byte(*s.AdvancedLoggingConfig) } + if !utils.IsEmptyJSON(s.AdvancedLoggingJSON) { + return s.AdvancedLoggingJSON + } return []byte("{}") } @@ -1477,18 +1488,23 @@ func (s *NotificationLogSettings) SetDefaults() { s.AdvancedLoggingJSON = []byte("{}") } } - s.AdvancedLoggingConfig = nil + // temporarily let AdvancedLoggingConfig take precedence. + if s.AdvancedLoggingConfig == nil { + s.AdvancedLoggingConfig = NewString("") + } + //s.AdvancedLoggingConfig = nil } // GetAdvancedLoggingConfig returns the advanced logging config as a []byte. // AdvancedLoggingJSON takes precident over the deprecated AdvancedLoggingConfig. func (s *NotificationLogSettings) GetAdvancedLoggingConfig() []byte { - if !utils.IsEmptyJSON(s.AdvancedLoggingJSON) { - return s.AdvancedLoggingJSON - } + // temporarily let AdvancedLoggingConfig take precedence. if s.AdvancedLoggingConfig != nil && !utils.IsEmptyJSON([]byte(*s.AdvancedLoggingConfig)) { return []byte(*s.AdvancedLoggingConfig) } + if !utils.IsEmptyJSON(s.AdvancedLoggingJSON) { + return s.AdvancedLoggingJSON + } return []byte("{}") }