aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-12-22 00:27:45 -0500
committerUnknwon <u@gogs.io>2016-12-22 00:27:45 -0500
commit79a2745b4af3420d154a28d64c5db65ec2ec363b (patch)
tree90a7e4ef220052e4fda8b1653d7384fef044ef8c
parent6cc992ea54eb45e4bc8d32df47ef8b17cf4ac84c (diff)
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.
-rw-r--r--modules/setting/setting.go2
-rw-r--r--routers/install.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 8ef8cef4..e7202b01 100644
--- a/modules/setting/setting.go
+++ b/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"))
diff --git a/routers/install.go b/routers/install.go
index 0c621e28..06acb264 100644
--- a/routers/install.go
+++ b/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))