demo1
This commit is contained in:
parent
63b8502bbb
commit
888ab96580
|
|
@ -24,6 +24,7 @@ func Service(conf *Config) *Config {
|
|||
}
|
||||
go func() {
|
||||
router := gin.New()
|
||||
router.Use(gin.Logger(), gin.Recovery())
|
||||
routerSetup(router, &conf.RootPath)
|
||||
|
||||
if conf.Ssl {
|
||||
|
|
|
|||
9
main.go
9
main.go
|
|
@ -21,7 +21,7 @@ func main() {
|
|||
consul.Init(nil)
|
||||
|
||||
gin.Service(&gin.Config{
|
||||
RootPath: `/`,
|
||||
RootPath: `/demo1`,
|
||||
Addr: *addr,
|
||||
Port: *port,
|
||||
})
|
||||
|
|
@ -37,6 +37,13 @@ func main() {
|
|||
<-c
|
||||
_, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
|
||||
//取消注册
|
||||
err := consul.DeRegister(*appname, *addr, 8082)
|
||||
if err != nil {
|
||||
fmt.Println("Error: ", err)
|
||||
}
|
||||
|
||||
fmt.Println("campus-demo1 service shutting down")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue