From cd487c812cbc8d4fe1edca0007684802f7dddeeb Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Thu, 5 May 2022 10:41:18 -0400 Subject: [PATCH] MM-41211: Allows rollback without destroying previous config setting. (#20137) * MM-41211: Allows rollback without destroying previous config setting. * MM-41211: Revert to original logic for unused config settings. * MM-41211: Moves days defaults before hours defaults. Co-authored-by: Mattermod --- model/config.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/model/config.go b/model/config.go index 50b62204d72..5972c028a8b 100644 --- a/model/config.go +++ b/model/config.go @@ -599,6 +599,14 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.ExtendSessionLengthWithActivity = NewBool(!isUpdate) } + if s.SessionLengthWebInDays == nil { + if isUpdate { + s.SessionLengthWebInDays = NewInt(180) + } else { + s.SessionLengthWebInDays = NewInt(30) + } + } + if s.SessionLengthWebInHours == nil { var webTTLDays int if s.SessionLengthWebInDays == nil { @@ -612,7 +620,14 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { } s.SessionLengthWebInHours = NewInt(webTTLDays * 24) } - s.SessionLengthWebInDays = NewInt(-1) + + if s.SessionLengthMobileInDays == nil { + if isUpdate { + s.SessionLengthMobileInDays = NewInt(180) + } else { + s.SessionLengthMobileInDays = NewInt(30) + } + } if s.SessionLengthMobileInHours == nil { var mobileTTLDays int @@ -627,7 +642,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { } s.SessionLengthMobileInHours = NewInt(mobileTTLDays * 24) } - s.SessionLengthMobileInDays = NewInt(-1) + + if s.SessionLengthSSOInDays == nil { + s.SessionLengthSSOInDays = NewInt(30) + } if s.SessionLengthSSOInHours == nil { var ssoTTLDays int @@ -638,7 +656,6 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { } s.SessionLengthSSOInHours = NewInt(ssoTTLDays * 24) } - s.SessionLengthSSOInDays = NewInt(-1) if s.SessionCacheInMinutes == nil { s.SessionCacheInMinutes = NewInt(10)