From 0aec472035598a4da1baea8524f4b942fbbae076 Mon Sep 17 00:00:00 2001 From: koneu Date: Thu, 7 Jan 2016 07:47:27 +0100 Subject: [PATCH] make macaron setup public --- cmd/web.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/web.go b/cmd/web.go index 9867c8c30..e451d810a 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -175,10 +175,7 @@ func newMacaron() *macaron.Macaron { return m } -func runWeb(ctx *cli.Context) { - if ctx.IsSet("config") { - setting.CustomConf = ctx.String("config") - } +func Macaron() *macaron.Macaron { routers.GlobalInit() checkVersion() @@ -548,6 +545,14 @@ func runWeb(ctx *cli.Context) { // Not found handler. m.NotFound(routers.NotFound) + return m +} + +func runWeb(ctx *cli.Context) { + if ctx.IsSet("config") { + setting.CustomConf = ctx.String("config") + } + m := Macaron() // Flag for port number in case first time run conflict. if ctx.IsSet("port") { setting.AppUrl = strings.Replace(setting.AppUrl, setting.HttpPort, ctx.String("port"), 1)