From 14e8ef9ecb7c79ba8adff6fee44fc9bfb669814c Mon Sep 17 00:00:00 2001
From: silverwind <me@silverwind.io>
Date: Tue, 1 Dec 2020 02:54:44 +0100
Subject: [PATCH] Flip RUN_MODE detection in router (#13768)

Missed that part in https://github.com/go-gitea/gitea/pull/13765. It's
already in the 1.13 backport so this forward-ports that change again.
---
 routers/init.go | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/routers/init.go b/routers/init.go
index 6434fa89ba..6f6c1cfcd6 100644
--- a/routers/init.go
+++ b/routers/init.go
@@ -43,13 +43,15 @@ import (
 )
 
 func checkRunMode() {
-	switch setting.Cfg.Section("").Key("RUN_MODE").String() {
-	case "prod":
+	switch setting.RunMode {
+	case "dev":
+		git.Debug = true
+	case "test":
+		git.Debug = true
+	default:
 		macaron.Env = macaron.PROD
 		macaron.ColorLog = false
 		setting.ProdMode = true
-	default:
-		git.Debug = true
 	}
 	log.Info("Run Mode: %s", strings.Title(macaron.Env))
 }