mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 10:58:11 +01:00
Little bug fix
This commit is contained in:
parent
d72fdc9900
commit
ff48aeddef
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/avatar"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/bin"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"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{},
|
||||
}
|
||||
|
||||
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 {
|
||||
r := martini.NewRouter()
|
||||
m := martini.New()
|
||||
@ -52,6 +65,7 @@ func newMartini() *martini.ClassicMartini {
|
||||
}
|
||||
|
||||
func runWeb(*cli.Context) {
|
||||
checkVersion()
|
||||
routers.GlobalInit()
|
||||
|
||||
m := newMartini()
|
||||
|
12
gogs.go
12
gogs.go
@ -14,8 +14,6 @@ import (
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
"github.com/gogits/gogs/cmd"
|
||||
"github.com/gogits/gogs/modules/bin"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@ -23,17 +21,7 @@ const APP_VER = "0.3.6.0525 Alpha"
|
||||
|
||||
func init() {
|
||||
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
|
||||
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() {
|
||||
|
@ -99,6 +99,7 @@ func WorkDir() (string, error) {
|
||||
}
|
||||
|
||||
// NewConfigContext initializes configuration context.
|
||||
// NOTE: do not print any log except error.
|
||||
func NewConfigContext() {
|
||||
workDir, err := WorkDir()
|
||||
if err != nil {
|
||||
@ -118,7 +119,6 @@ func NewConfigContext() {
|
||||
if len(CustomPath) == 0 {
|
||||
CustomPath = path.Join(workDir, "custom")
|
||||
}
|
||||
log.Trace("Custom path: %s", CustomPath)
|
||||
|
||||
cfgPath := path.Join(CustomPath, "conf/app.ini")
|
||||
if com.IsFile(cfgPath) {
|
||||
|
@ -46,6 +46,7 @@ func NewServices() {
|
||||
// GlobalInit is for global configuration reload-able.
|
||||
func GlobalInit() {
|
||||
setting.NewConfigContext()
|
||||
log.Trace("Custom path: %s", setting.CustomPath)
|
||||
mailer.NewMailerContext()
|
||||
models.LoadModelsConfig()
|
||||
models.LoadRepoConfig()
|
||||
|
Loading…
Reference in New Issue
Block a user