Set default log path if empty during install
This commit is contained in:
parent
1feecd6beb
commit
ec478b4b06
2 changed files with 12 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue