Backend: Remove more globals (#29644)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-12-15 19:09:04 +01:00
committed by GitHub
parent aa8fb1ae98
commit dd2d206d99
35 changed files with 526 additions and 484 deletions

View File

@ -8,7 +8,7 @@ import (
"gopkg.in/macaron.v1"
)
func ValidateHostHeader(domain string) macaron.Handler {
func ValidateHostHeader(cfg *setting.Cfg) macaron.Handler {
return func(c *models.ReqContext) {
// ignore local render calls
if c.IsRenderCall {
@ -20,8 +20,8 @@ func ValidateHostHeader(domain string) macaron.Handler {
h = h[:i]
}
if !strings.EqualFold(h, domain) {
c.Redirect(strings.TrimSuffix(setting.AppUrl, "/")+c.Req.RequestURI, 301)
if !strings.EqualFold(h, cfg.Domain) {
c.Redirect(strings.TrimSuffix(cfg.AppURL, "/")+c.Req.RequestURI, 301)
return
}
}