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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f9843b3800
Коммит
860e5d483c
@@ -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, "")
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user