提交 086dcad8 编写于 作者: U Ulric Qin

move var Version to config package

上级 eaacf04c
......@@ -5,5 +5,5 @@ version=5.0.0-rc7-1
#export GO111MODULE=on
#export GOPROXY=https://goproxy.cn
go build -ldflags "-X main.version=${version}" -o n9e-server main.go
go build -ldflags "-X github.com/didi/nightingale/v5/config.Version=${version}" -o n9e-server main.go
......@@ -2,3 +2,5 @@ package config
// Server周期性去数据库心跳,给自己起的名字
const EndpointName = "server_rpc"
var Version = "not specified"
......@@ -37,6 +37,9 @@ func configRoutes(r *gin.Engine) {
guest.GET("/addr", func(c *gin.Context) {
c.String(200, c.Request.RemoteAddr)
})
guest.GET("/version", func(c *gin.Context) {
c.String(200, config.Version)
})
guest.POST("/auth/login", loginPost)
guest.GET("/auth/logout", logoutGet)
......
......@@ -26,8 +26,6 @@ import (
"github.com/didi/nightingale/v5/trans"
)
var version = "not specified"
var (
vers *bool
help *bool
......@@ -39,7 +37,7 @@ func init() {
flag.Parse()
if *vers {
fmt.Println("version:", version)
fmt.Println("version:", config.Version)
os.Exit(0)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册