From ec478b4b063e767eaf804216d2273d6e1f48d882 Mon Sep 17 00:00:00 2001 From: Josh Frye Date: Fri, 12 Feb 2016 10:03:04 -0500 Subject: [PATCH] Set default log path if empty during install --- routers/install.go | 10 ++++++++++ templates/install.tmpl | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/routers/install.go b/routers/install.go index b8b7dec1e7..668912960c 100644 --- a/routers/install.go +++ b/routers/install.go @@ -242,6 +242,16 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { return } + // Set default log path if empty. + workDir, err := setting.WorkDir() + if err != nil { + log.Fatal(4, "Fail to get work directory: %v", err) + } + + if len(form.LogRootPath) == 0 { + form.LogRootPath = path.Join(workDir, "log") + } + // Test log root path. form.LogRootPath = strings.Replace(form.LogRootPath, "\\", "/", -1) if err := os.MkdirAll(form.LogRootPath, os.ModePerm); err != nil { diff --git a/templates/install.tmpl b/templates/install.tmpl index b3d4d7339d..1d97abf528 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -109,9 +109,9 @@ {{.i18n.Tr "install.app_url_helper"}} -
+
- + {{.i18n.Tr "install.log_root_path_helper"}}