This commit is contained in:
tcq 2023-04-26 17:34:12 +08:00
parent f1c7f862c6
commit 63b8502bbb
3 changed files with 4 additions and 5 deletions

Binary file not shown.

View File

@ -20,13 +20,13 @@ func routerSetup(router *gin.Engine, rootpath *string) {
r.POST(`/forgot`)
}
ug := router.Group(`/user`)
ug := r.Group(`/user`)
{
ug.GET(`/choose/:orgid`)
ug.GET(`/detail`)
ug.POST(`/update`)
}
hell := router.Group("/token")
hell := r.Group("/token")
{
hell.GET("verify", handler.TokenVerify)

View File

@ -14,7 +14,6 @@ import (
func main() {
appname := flag.String("appname", "demo1", "app name for current")
tags := flag.String("tags", `PathPrefix("/demo")`, "consul tags")
port := flag.Int("port", 8080, "port for gin")
addr := flag.String("addr", "localhost", "ip address for gin")
flag.Parse()
@ -22,12 +21,12 @@ func main() {
consul.Init(nil)
gin.Service(&gin.Config{
RootPath: *appname,
RootPath: `/`,
Addr: *addr,
Port: *port,
})
traefikTag := fmt.Sprintf(`traefik.http.routers.%s.rule=%s`, *appname, *tags)
traefikTag := fmt.Sprintf("traefik.http.routers.%s.rule=PathPrefix(`/demo1`)", *appname)
if err := consul.RegisterAPI(*appname, *addr, *port, traefikTag); err != nil {
fmt.Println("注册失败", err.Error())
}