diff --git a/app/server.go b/app/server.go index bb1759bf44..3e93e9c69b 100644 --- a/app/server.go +++ b/app/server.go @@ -515,6 +515,7 @@ func (s *Server) Start() error { Handler: handler, ReadTimeout: time.Duration(*s.Config().ServiceSettings.ReadTimeout) * time.Second, WriteTimeout: time.Duration(*s.Config().ServiceSettings.WriteTimeout) * time.Second, + IdleTimeout: time.Duration(*s.Config().ServiceSettings.IdleTimeout) * time.Second, ErrorLog: errStdLog, } diff --git a/model/config.go b/model/config.go index 5cd61cb82e..f355865c8c 100644 --- a/model/config.go +++ b/model/config.go @@ -93,6 +93,7 @@ const ( SERVICE_SETTINGS_DEFAULT_TLS_KEY_FILE = "" SERVICE_SETTINGS_DEFAULT_READ_TIMEOUT = 300 SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT = 300 + SERVICE_SETTINGS_DEFAULT_IDLE_TIMEOUT = 60 SERVICE_SETTINGS_DEFAULT_MAX_LOGIN_ATTEMPTS = 10 SERVICE_SETTINGS_DEFAULT_ALLOW_CORS_FROM = "" SERVICE_SETTINGS_DEFAULT_LISTEN_AND_ADDRESS = ":8065" @@ -256,6 +257,7 @@ type ServiceSettings struct { TrustedProxyIPHeader []string `restricted:"true"` ReadTimeout *int `restricted:"true"` WriteTimeout *int `restricted:"true"` + IdleTimeout *int `restricted:"true"` MaximumLoginAttempts *int `restricted:"true"` GoroutineHealthThreshold *int `restricted:"true"` GoogleDeveloperKey *string `restricted:"true"` @@ -459,6 +461,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.WriteTimeout = NewInt(SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT) } + if s.IdleTimeout == nil { + s.IdleTimeout = NewInt(SERVICE_SETTINGS_DEFAULT_IDLE_TIMEOUT) + } + if s.MaximumLoginAttempts == nil { s.MaximumLoginAttempts = NewInt(SERVICE_SETTINGS_DEFAULT_MAX_LOGIN_ATTEMPTS) }