summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-10-20 22:37:19 +0800
committerGitHub <noreply@github.com>2021-10-20 16:37:19 +0200
commitf494776931b71f83fdfdd4e68e850529c4b2614f (patch)
tree92b3779237dadfe042d3f93e9ddaaaac5d6d385f /routers/web
parent0208ea0248782a994771cadf0af6a4125fdde723 (diff)
downloadgitea-f494776931b71f83fdfdd4e68e850529c4b2614f.tar.gz
gitea-f494776931b71f83fdfdd4e68e850529c4b2614f.zip
Use a variable but a function for IsProd because of a slight performance increment (#17368)
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/base.go4
-rw-r--r--routers/web/web.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/routers/web/base.go b/routers/web/base.go
index f50c5229b1..16d3192da2 100644
--- a/routers/web/base.go
+++ b/routers/web/base.go
@@ -131,7 +131,7 @@ func Recovery() func(next http.Handler) http.Handler {
sessionStore := session.GetSession(req)
if sessionStore == nil {
- if setting.IsProd() {
+ if setting.IsProd {
http.Error(w, http.StatusText(500), 500)
} else {
http.Error(w, combinedErr, 500)
@@ -164,7 +164,7 @@ func Recovery() func(next http.Handler) http.Handler {
w.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)
- if !setting.IsProd() {
+ if !setting.IsProd {
store["ErrorMsg"] = combinedErr
}
err = rnd.HTML(w, 500, "status/500", templates.BaseVars().Merge(store))
diff --git a/routers/web/web.go b/routers/web/web.go
index caec067671..88565d6d85 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -477,7 +477,7 @@ func RegisterRoutes(m *web.Route) {
m.Post("/action/{action}", user.Action)
}, reqSignIn)
- if !setting.IsProd() {
+ if !setting.IsProd {
m.Get("/template/*", dev.TemplatePreview)
}