diff options
author | JoramWilander <jwawilander@gmail.com> | 2018-06-30 12:24:04 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2018-06-30 12:24:04 -0400 |
commit | 3848cb7e79e019e2f0878d6e2377ad36b3c7ca43 (patch) | |
tree | 98beeb962ffc6d7c3f8cd38651eaccab4a9685fa /model/config.go | |
parent | 88c5e469ca869d9e8ceadb0f2b03e86005102f24 (diff) | |
parent | 2362a5b7f7c2b4bf2b35b104e8616d847b33b0be (diff) | |
download | chat-3848cb7e79e019e2f0878d6e2377ad36b3c7ca43.tar.gz chat-3848cb7e79e019e2f0878d6e2377ad36b3c7ca43.tar.bz2 chat-3848cb7e79e019e2f0878d6e2377ad36b3c7ca43.zip |
Merge branch 'master' into plugins-2
Diffstat (limited to 'model/config.go')
-rw-r--r-- | model/config.go | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/model/config.go b/model/config.go index ce66f2f05..e6bd04dfc 100644 --- a/model/config.go +++ b/model/config.go @@ -605,15 +605,16 @@ type SSOSettings struct { } type SqlSettings struct { - DriverName *string - DataSource *string - DataSourceReplicas []string - DataSourceSearchReplicas []string - MaxIdleConns *int - MaxOpenConns *int - Trace bool - AtRestEncryptKey string - QueryTimeout *int + DriverName *string + DataSource *string + DataSourceReplicas []string + DataSourceSearchReplicas []string + MaxIdleConns *int + ConnMaxLifetimeMilliseconds *int + MaxOpenConns *int + Trace bool + AtRestEncryptKey string + QueryTimeout *int } func (s *SqlSettings) SetDefaults() { @@ -637,6 +638,10 @@ func (s *SqlSettings) SetDefaults() { s.MaxOpenConns = NewInt(300) } + if s.ConnMaxLifetimeMilliseconds == nil { + s.ConnMaxLifetimeMilliseconds = NewInt(3600000) + } + if s.QueryTimeout == nil { s.QueryTimeout = NewInt(30) } @@ -2069,6 +2074,10 @@ func (ss *SqlSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.sql_idle.app_error", nil, "", http.StatusBadRequest) } + if *ss.ConnMaxLifetimeMilliseconds < 0 { + return NewAppError("Config.IsValid", "model.config.is_valid.sql_conn_max_lifetime_milliseconds.app_error", nil, "", http.StatusBadRequest) + } + if *ss.QueryTimeout <= 0 { return NewAppError("Config.IsValid", "model.config.is_valid.sql_query_timeout.app_error", nil, "", http.StatusBadRequest) } |