Little bug fix
This commit is contained in:
parent
d72fdc9900
commit
ff48aeddef
4 changed files with 16 additions and 13 deletions
14
cmd/web.go
14
cmd/web.go
|
@ -18,6 +18,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/auth/apiv1"
|
"github.com/gogits/gogs/modules/auth/apiv1"
|
||||||
"github.com/gogits/gogs/modules/avatar"
|
"github.com/gogits/gogs/modules/avatar"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
"github.com/gogits/gogs/modules/bin"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
"github.com/gogits/gogs/modules/middleware/binding"
|
"github.com/gogits/gogs/modules/middleware/binding"
|
||||||
|
@ -39,6 +40,18 @@ and it takes care of all the other things for you`,
|
||||||
Flags: []cli.Flag{},
|
Flags: []cli.Flag{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkVersion() {
|
||||||
|
// go-bindata -ignore=\\.DS_Store -o modules/bin/conf.go -pkg="bin" conf/...
|
||||||
|
// Check if binary and static file version match.
|
||||||
|
data, err := bin.Asset("conf/VERSION")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Fail to read 'conf/VERSION': %v", err)
|
||||||
|
}
|
||||||
|
if string(data) != setting.AppVer {
|
||||||
|
log.Fatal("Binary and static file version does not match, did you forget to recompile?")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func newMartini() *martini.ClassicMartini {
|
func newMartini() *martini.ClassicMartini {
|
||||||
r := martini.NewRouter()
|
r := martini.NewRouter()
|
||||||
m := martini.New()
|
m := martini.New()
|
||||||
|
@ -52,6 +65,7 @@ func newMartini() *martini.ClassicMartini {
|
||||||
}
|
}
|
||||||
|
|
||||||
func runWeb(*cli.Context) {
|
func runWeb(*cli.Context) {
|
||||||
|
checkVersion()
|
||||||
routers.GlobalInit()
|
routers.GlobalInit()
|
||||||
|
|
||||||
m := newMartini()
|
m := newMartini()
|
||||||
|
|
12
gogs.go
12
gogs.go
|
@ -14,8 +14,6 @@ import (
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
|
||||||
"github.com/gogits/gogs/cmd"
|
"github.com/gogits/gogs/cmd"
|
||||||
"github.com/gogits/gogs/modules/bin"
|
|
||||||
"github.com/gogits/gogs/modules/log"
|
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,17 +21,7 @@ const APP_VER = "0.3.6.0525 Alpha"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
||||||
// go-bindata -ignore=\\.DS_Store -debug -o modules/bin/conf.go -pkg="bin" conf/...
|
|
||||||
// Set and check if binary and static file version match.
|
|
||||||
setting.AppVer = APP_VER
|
setting.AppVer = APP_VER
|
||||||
data, err := bin.Asset("conf/VERSION")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Fail to read 'conf/VERSION': %v", err)
|
|
||||||
}
|
|
||||||
if string(data) != setting.AppVer {
|
|
||||||
log.Fatal("Binary and static file version does not match, did you forget to recompile?")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -99,6 +99,7 @@ func WorkDir() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConfigContext initializes configuration context.
|
// NewConfigContext initializes configuration context.
|
||||||
|
// NOTE: do not print any log except error.
|
||||||
func NewConfigContext() {
|
func NewConfigContext() {
|
||||||
workDir, err := WorkDir()
|
workDir, err := WorkDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -118,7 +119,6 @@ func NewConfigContext() {
|
||||||
if len(CustomPath) == 0 {
|
if len(CustomPath) == 0 {
|
||||||
CustomPath = path.Join(workDir, "custom")
|
CustomPath = path.Join(workDir, "custom")
|
||||||
}
|
}
|
||||||
log.Trace("Custom path: %s", CustomPath)
|
|
||||||
|
|
||||||
cfgPath := path.Join(CustomPath, "conf/app.ini")
|
cfgPath := path.Join(CustomPath, "conf/app.ini")
|
||||||
if com.IsFile(cfgPath) {
|
if com.IsFile(cfgPath) {
|
||||||
|
|
|
@ -46,6 +46,7 @@ func NewServices() {
|
||||||
// GlobalInit is for global configuration reload-able.
|
// GlobalInit is for global configuration reload-able.
|
||||||
func GlobalInit() {
|
func GlobalInit() {
|
||||||
setting.NewConfigContext()
|
setting.NewConfigContext()
|
||||||
|
log.Trace("Custom path: %s", setting.CustomPath)
|
||||||
mailer.NewMailerContext()
|
mailer.NewMailerContext()
|
||||||
models.LoadModelsConfig()
|
models.LoadModelsConfig()
|
||||||
models.LoadRepoConfig()
|
models.LoadRepoConfig()
|
||||||
|
|
Loading…
Reference in a new issue