1
0
فهرست منبع

Set ProdMode in the correct place

Closes #3696, #3611

Previously, ProdMode can only be true for web server,
which always prints dev mode log message to incoming SSH
connections and leaks unexpected information.
Unknwon 10 سال پیش
والد
کامیت
79a2745b4a
2فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 2 0
      modules/setting/setting.go
  2. 2 4
      routers/install.go

+ 2 - 0
modules/setting/setting.go

@@ -490,6 +490,8 @@ func NewContext() {
 		}
 	}
 
+	ProdMode = Cfg.Section("").Key("RUN_MODE").String() == "prod"
+
 	// Determine and create root git repository path.
 	sec = Cfg.Section("repository")
 	RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gogs-repositories"))

+ 2 - 4
routers/install.go

@@ -38,12 +38,10 @@ const (
 )
 
 func checkRunMode() {
-	switch setting.Cfg.Section("").Key("RUN_MODE").String() {
-	case "prod":
+	if setting.ProdMode {
 		macaron.Env = macaron.PROD
 		macaron.ColorLog = false
-		setting.ProdMode = true
-	default:
+	} else {
 		git.Debug = true
 	}
 	log.Info("Run Mode: %s", strings.Title(macaron.Env))