go: set global default {read,write} timeouts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2023-08-03 14:40:04 +02:00
parent 258c6accf0
commit 044ed583b9
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

@ -6,6 +6,7 @@ package app
import ( import (
"encoding/hex" "encoding/hex"
"net/http" "net/http"
"time"
"github.com/gorilla/sessions" "github.com/gorilla/sessions"
"github.com/labstack/echo-contrib/session" "github.com/labstack/echo-contrib/session"
@ -43,6 +44,10 @@ func (a *App) SetEchoSettings() {
// }, // },
// })) // }))
// TODO: make this configurable.
e.Server.WriteTimeout = 30 * time.Second
e.Server.ReadHeaderTimeout = 30 * time.Second
if a.setting.HTTPRateLimitEnabled() { if a.setting.HTTPRateLimitEnabled() {
limit := rate.Limit(a.setting.HTTPRateLimit()) limit := rate.Limit(a.setting.HTTPRateLimit())