diff options
Diffstat (limited to 'routers/install.go')
-rw-r--r-- | routers/install.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/routers/install.go b/routers/install.go index 120aa468..b8b7dec1 100644 --- a/routers/install.go +++ b/routers/install.go @@ -28,7 +28,7 @@ import ( "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/ssh" - "github.com/gogits/gogs/modules/template" + "github.com/gogits/gogs/modules/template/highlight" "github.com/gogits/gogs/modules/user" ) @@ -56,7 +56,7 @@ func NewServices() { // GlobalInit is for global configuration reload-able. func GlobalInit() { setting.NewContext() - template.NewContext() + highlight.NewContext() log.Trace("Custom path: %s", setting.CustomPath) log.Trace("Log path: %s", setting.LogRootPath) models.LoadConfigs() @@ -91,6 +91,9 @@ func GlobalInit() { ssh.Listen(setting.SSHPort) log.Info("SSH server started on :%v", setting.SSHPort) } + + // Build Sanitizer + base.BuildSanitizer() } func InstallInit(ctx *middleware.Context) { @@ -151,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 { @@ -238,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 { @@ -326,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)) |