move var Version to config package
This commit is contained in:
parent
eaacf04c68
commit
086dcad81f
2
build.sh
2
build.sh
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue