summaryrefslogtreecommitdiffstats
path: root/routers/install.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-30 11:58:21 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-30 11:58:21 -0400
commit3698431fc11f740ecc043822fba8af895fc12423 (patch)
tree327c4a575bfc91253c305b7214969011950535ec /routers/install.go
parent9f91dee53fc602a939abf1219ec6ddb128c2067c (diff)
downloadgitea-3698431fc11f740ecc043822fba8af895fc12423.tar.gz
gitea-3698431fc11f740ecc043822fba8af895fc12423.zip
Fix install bugs
Diffstat (limited to 'routers/install.go')
-rw-r--r--routers/install.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/routers/install.go b/routers/install.go
index 6f29badcfa..cca652f9cf 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -131,6 +131,17 @@ func Install(ctx *middleware.Context, form auth.InstallForm) {
return
}
+ // Check run user.
+ curUser := os.Getenv("USERNAME")
+ if len(curUser) == 0 {
+ curUser = os.Getenv("USER")
+ }
+ // Does not check run user when the install lock is off.
+ if form.RunUser != curUser {
+ ctx.RenderWithErr("Run user isn't the current user: "+form.RunUser+" -> "+curUser, "install", &form)
+ return
+ }
+
// Save settings.
base.Cfg.SetValue("database", "DB_TYPE", models.DbCfg.Type)
base.Cfg.SetValue("database", "HOST", models.DbCfg.Host)
@@ -155,8 +166,11 @@ func Install(ctx *middleware.Context, form auth.InstallForm) {
base.Cfg.SetValue("service", "ENABLE_NOTIFY_MAIL", base.ToStr(form.MailNotify == "on"))
}
+ base.Cfg.SetValue("", "RUN_MODE", "prod")
+
base.Cfg.SetValue("security", "INSTALL_LOCK", "true")
+ os.MkdirAll("custom/conf", os.ModePerm)
if err := goconfig.SaveConfigFile(base.Cfg, "custom/conf/app.ini"); err != nil {
ctx.RenderWithErr("Fail to save configuration: "+err.Error(), "install", &form)
return