From a3e8c32a30ef90f5aa0526e8440aa343378dbf26 Mon Sep 17 00:00:00 2001 From: Josh Frye Date: Fri, 12 Feb 2016 09:19:45 -0500 Subject: Add install option for log path --- routers/install.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'routers') diff --git a/routers/install.go b/routers/install.go index fc9e5ec5e1..b8b7dec1e7 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)) -- cgit v1.2.3