File tree 4 files changed +16
-13
lines changed 4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
18
18
"github.com/gogits/gogs/modules/auth/apiv1"
19
19
"github.com/gogits/gogs/modules/avatar"
20
20
"github.com/gogits/gogs/modules/base"
21
+ "github.com/gogits/gogs/modules/bin"
21
22
"github.com/gogits/gogs/modules/log"
22
23
"github.com/gogits/gogs/modules/middleware"
23
24
"github.com/gogits/gogs/modules/middleware/binding"
@@ -39,6 +40,18 @@ and it takes care of all the other things for you`,
39
40
Flags : []cli.Flag {},
40
41
}
41
42
43
+ func checkVersion () {
44
+ // go-bindata -ignore=\\.DS_Store -o modules/bin/conf.go -pkg="bin" conf/...
45
+ // Check if binary and static file version match.
46
+ data , err := bin .Asset ("conf/VERSION" )
47
+ if err != nil {
48
+ log .Fatal ("Fail to read 'conf/VERSION': %v" , err )
49
+ }
50
+ if string (data ) != setting .AppVer {
51
+ log .Fatal ("Binary and static file version does not match, did you forget to recompile?" )
52
+ }
53
+ }
54
+
42
55
func newMartini () * martini.ClassicMartini {
43
56
r := martini .NewRouter ()
44
57
m := martini .New ()
@@ -52,6 +65,7 @@ func newMartini() *martini.ClassicMartini {
52
65
}
53
66
54
67
func runWeb (* cli.Context ) {
68
+ checkVersion ()
55
69
routers .GlobalInit ()
56
70
57
71
m := newMartini ()
Original file line number Diff line number Diff line change @@ -14,26 +14,14 @@ import (
14
14
"github.com/codegangsta/cli"
15
15
16
16
"github.com/gogits/gogs/cmd"
17
- "github.com/gogits/gogs/modules/bin"
18
- "github.com/gogits/gogs/modules/log"
19
17
"github.com/gogits/gogs/modules/setting"
20
18
)
21
19
22
20
const APP_VER = "0.3.6.0525 Alpha"
23
21
24
22
func init () {
25
23
runtime .GOMAXPROCS (runtime .NumCPU ())
26
-
27
- // go-bindata -ignore=\\.DS_Store -debug -o modules/bin/conf.go -pkg="bin" conf/...
28
- // Set and check if binary and static file version match.
29
24
setting .AppVer = APP_VER
30
- data , err := bin .Asset ("conf/VERSION" )
31
- if err != nil {
32
- log .Fatal ("Fail to read 'conf/VERSION': %v" , err )
33
- }
34
- if string (data ) != setting .AppVer {
35
- log .Fatal ("Binary and static file version does not match, did you forget to recompile?" )
36
- }
37
25
}
38
26
39
27
func main () {
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ func WorkDir() (string, error) {
99
99
}
100
100
101
101
// NewConfigContext initializes configuration context.
102
+ // NOTE: do not print any log except error.
102
103
func NewConfigContext () {
103
104
workDir , err := WorkDir ()
104
105
if err != nil {
@@ -118,7 +119,6 @@ func NewConfigContext() {
118
119
if len (CustomPath ) == 0 {
119
120
CustomPath = path .Join (workDir , "custom" )
120
121
}
121
- log .Trace ("Custom path: %s" , CustomPath )
122
122
123
123
cfgPath := path .Join (CustomPath , "conf/app.ini" )
124
124
if com .IsFile (cfgPath ) {
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ func NewServices() {
46
46
// GlobalInit is for global configuration reload-able.
47
47
func GlobalInit () {
48
48
setting .NewConfigContext ()
49
+ log .Trace ("Custom path: %s" , setting .CustomPath )
49
50
mailer .NewMailerContext ()
50
51
models .LoadModelsConfig ()
51
52
models .LoadRepoConfig ()
You can’t perform that action at this time.
0 commit comments