diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-05-29 15:46:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-29 15:46:35 -0400 |
commit | 860e5d483cd952ec833c40312a2141bb3e4ef579 (patch) | |
tree | a854943f1f008f9b0f607f486de4b117b98e08e4 /model | |
parent | f9843b380074cc6082566a2752c5482210f912bb (diff) | |
download | chat-860e5d483cd952ec833c40312a2141bb3e4ef579.tar.gz chat-860e5d483cd952ec833c40312a2141bb3e4ef579.tar.bz2 chat-860e5d483cd952ec833c40312a2141bb3e4ef579.zip |
PLT-6341/PLT-6342 Update gorp to mattermost fork and add connection timeout setting (#6410)
* Update gorp to mattermost fork and add connection timeout setting
* Add go dependency
* Rename from connection timeout to query timeout
* Properly add gorp dependency
Diffstat (limited to 'model')
-rw-r--r-- | model/config.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go index 8c1814792..311a34610 100644 --- a/model/config.go +++ b/model/config.go @@ -6,6 +6,7 @@ package model import ( "encoding/json" "io" + "net/http" "net/url" ) @@ -195,6 +196,7 @@ type SqlSettings struct { MaxOpenConns int Trace bool AtRestEncryptKey string + QueryTimeout *int } type LogSettings struct { @@ -480,6 +482,11 @@ func (o *Config) SetDefaults() { o.SqlSettings.AtRestEncryptKey = NewRandomString(32) } + if o.SqlSettings.QueryTimeout == nil { + o.SqlSettings.QueryTimeout = new(int) + *o.SqlSettings.QueryTimeout = 30 + } + if o.FileSettings.AmazonS3Endpoint == "" { // Defaults to "s3.amazonaws.com" o.FileSettings.AmazonS3Endpoint = "s3.amazonaws.com" @@ -1322,6 +1329,10 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_idle.app_error", nil, "") } + if *o.SqlSettings.QueryTimeout <= 0 { + return NewAppError("Config.IsValid", "model.config.is_valid.sql_query_timeout.app_error", nil, "", http.StatusBadRequest) + } + if len(o.SqlSettings.DataSource) == 0 { return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_data_src.app_error", nil, "") } |