diff options
author | lunnyxiao <xiaolunwen@gmail.com> | 2014-08-08 13:51:43 +0800 |
---|---|---|
committer | lunnyxiao <xiaolunwen@gmail.com> | 2014-08-08 13:51:43 +0800 |
commit | 7c7014262bdf90880826e6e6cc802bdab300b5ae (patch) | |
tree | a3b9803b8cb8ecc23517e73c1d0cdf73dcb213d5 /cmd/web.go | |
parent | 57f6ec672ab059c57689a45c7f657923718e62bf (diff) | |
parent | 9d5c0c80a4984acc1a42da8360a712e4f5f615a0 (diff) |
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'cmd/web.go')
-rw-r--r-- | cmd/web.go | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -19,7 +19,9 @@ import ( "github.com/macaron-contrib/csrf" "github.com/macaron-contrib/i18n" "github.com/macaron-contrib/session" + "github.com/macaron-contrib/toolbox" + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/auth/apiv1" "github.com/gogits/gogs/modules/avatar" @@ -62,20 +64,20 @@ func newMacaron() *macaron.Macaron { m := macaron.New() m.Use(macaron.Logger()) m.Use(macaron.Recovery()) - if setting.EnableGzip { - m.Use(macaron.Gzip()) - } m.Use(macaron.Static("public", macaron.StaticOptions{ SkipLogging: !setting.DisableRouterLog, }, )) + if setting.EnableGzip { + m.Use(macaron.Gzip()) + } m.Use(macaron.Renderer(macaron.RenderOptions{ Directory: path.Join(setting.StaticRootPath, "templates"), Funcs: []template.FuncMap{base.TemplateFuncs}, IndentJSON: macaron.Env != macaron.PROD, })) - m.Use(i18n.I18n(i18n.LocaleOptions{ + m.Use(i18n.I18n(i18n.Options{ Langs: setting.Langs, Names: setting.Names, Redirect: true, @@ -94,6 +96,14 @@ func newMacaron() *macaron.Macaron { Secret: setting.SecretKey, SetCookie: true, })) + m.Use(toolbox.Toolboxer(m, toolbox.Options{ + HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{ + &toolbox.HealthCheckFuncDesc{ + Desc: "Database connection", + Func: models.Ping, + }, + }, + })) m.Use(middleware.Contexter()) return m } @@ -208,7 +218,6 @@ func runWeb(*cli.Context) { if macaron.Env == macaron.DEV { m.Get("/template/*", dev.TemplatePreview) - dev.RegisterDebugRoutes(m) } reqTrueOwner := middleware.RequireTrueOwner() @@ -245,8 +254,7 @@ func runWeb(*cli.Context) { r.Get("/settings", repo.Settings) r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingsPost) m.Group("/settings", func(r *macaron.Router) { - r.Get("/collaboration", repo.Collaboration) - r.Post("/collaboration", repo.CollaborationPost) + r.Route("/collaboration", "GET,POST", repo.SettingsCollaboration) r.Get("/hooks", repo.WebHooks) r.Get("/hooks/add", repo.WebHooksAdd) r.Post("/hooks/add", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksAddPost) |