|
|
@ -6,6 +6,7 @@ package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"html/template" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/codegangsta/cli" |
|
|
|
"github.com/codegangsta/cli" |
|
|
@ -30,13 +31,19 @@ gogs web`, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AppHelpers template.FuncMap = map[string]interface{}{ |
|
|
|
|
|
|
|
"AppName": func() string { |
|
|
|
|
|
|
|
return utils.Cfg.MustValue("", "APP_NAME") |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runWeb(*cli.Context) { |
|
|
|
func runWeb(*cli.Context) { |
|
|
|
log.Info("%s %s", utils.Cfg.MustValue("", "APP_NAME"), APP_VER) |
|
|
|
log.Info("%s %s", utils.Cfg.MustValue("", "APP_NAME"), APP_VER) |
|
|
|
|
|
|
|
|
|
|
|
m := martini.Classic() |
|
|
|
m := martini.Classic() |
|
|
|
|
|
|
|
|
|
|
|
// Middleware.
|
|
|
|
// Middleware.
|
|
|
|
m.Use(render.Renderer()) |
|
|
|
m.Use(render.Renderer(render.Options{Funcs: []template.FuncMap{AppHelpers}})) |
|
|
|
|
|
|
|
|
|
|
|
// Routers.
|
|
|
|
// Routers.
|
|
|
|
m.Get("/", routers.Dashboard) |
|
|
|
m.Get("/", routers.Dashboard) |
|
|
|