-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
52 lines (43 loc) · 1.15 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"github.com/gin-gonic/gin"
"github.com/hitokoto-osc/Vive/config"
"github.com/hitokoto-osc/Vive/flag"
"github.com/hitokoto-osc/Vive/prestart"
"github.com/hitokoto-osc/Vive/routes"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"runtime"
)
var (
// BuildTag is a commit hash that will be injected in release mode
BuildTag = "Unknown"
// BuildTime is a time, when it build, that will be injected in release mode
BuildTime = "Unknown"
// MakeVersion is the version of make in release, will be injected in release mode
MakeVersion = "Unknown"
// Version is the version of this program, will be injected in release mode
Version = "development"
)
var r *gin.Engine
func init() {
// global set build information
config.BuildTag = BuildTag
config.BuildTime = BuildTime
config.GoVersion = runtime.Version()
config.MakeVersion = MakeVersion
config.Version = Version
// Parse Flag
flag.Parse()
// Init Drivers
prestart.Do()
if config.Debug {
log.Info("[debug] 已启用调试模式")
}
// init Web Server
r = routes.InitWebServer()
}
func main() {
// start Server
r.Run(":" + viper.GetString("server.port"))
}