Add some config options
This commit is contained in:
parent
d886f4df97
commit
a3a93aef11
4 changed files with 59 additions and 13 deletions
13
web.go
13
web.go
|
@ -8,6 +8,7 @@ import (
|
|||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/codegangsta/martini"
|
||||
|
@ -34,8 +35,20 @@ gogs web`,
|
|||
Flags: []cli.Flag{},
|
||||
}
|
||||
|
||||
// Check run mode(Default of martini is Dev).
|
||||
func checkRunMode() {
|
||||
switch base.Cfg.MustValue("", "RUN_MODE") {
|
||||
case "prod":
|
||||
martini.Env = martini.Prod
|
||||
case "test":
|
||||
martini.Env = martini.Test
|
||||
}
|
||||
log.Info("Run Mode: %s", strings.Title(martini.Env))
|
||||
}
|
||||
|
||||
func runWeb(*cli.Context) {
|
||||
log.Info("%s %s", base.AppName, base.AppVer)
|
||||
checkRunMode()
|
||||
|
||||
m := martini.Classic()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue