summaryrefslogtreecommitdiffstats
path: root/model/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/config.go')
-rw-r--r--model/config.go11
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, "")
}