diff options
author | Unknwon <u@gogs.io> | 2016-02-12 10:21:46 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-12 10:21:46 -0500 |
commit | 25845ea1a5f18c81d7dc3441d3184ae042a81bf3 (patch) | |
tree | 3d9f434f21642baae4d2350372a43617f1459533 /routers/install.go | |
parent | 779bb890faaccab7e18d5d1163976b25a7219cc6 (diff) | |
parent | d3ca5accfd418d789765284542334411337fa45f (diff) |
Merge pull request #2609 from joshfng/add-config-log-path
Add install option for log path
Diffstat (limited to 'routers/install.go')
-rw-r--r-- | routers/install.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/install.go b/routers/install.go index fc9e5ec5..b8b7dec1 100644 --- a/routers/install.go +++ b/routers/install.go @@ -154,6 +154,7 @@ func Install(ctx *middleware.Context) { form.SSHPort = setting.SSHPort form.HTTPPort = setting.HttpPort form.AppUrl = setting.AppUrl + form.LogRootPath = setting.LogRootPath // E-mail service settings if setting.MailService != nil { @@ -241,6 +242,14 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { return } + // Test log root path. + form.LogRootPath = strings.Replace(form.LogRootPath, "\\", "/", -1) + if err := os.MkdirAll(form.LogRootPath, os.ModePerm); err != nil { + ctx.Data["Err_LogRootPath"] = true + ctx.RenderWithErr(ctx.Tr("install.invalid_log_root_path", err), INSTALL, &form) + return + } + // Check run user. curUser := user.CurrentUsername() if form.RunUser != curUser { @@ -329,6 +338,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { cfg.Section("log").Key("MODE").SetValue("file") cfg.Section("log").Key("LEVEL").SetValue("Info") + cfg.Section("log").Key("ROOT_PATH").SetValue(form.LogRootPath) cfg.Section("security").Key("INSTALL_LOCK").SetValue("true") cfg.Section("security").Key("SECRET_KEY").SetValue(base.GetRandomString(15)) |