package main import ( "app.yhyue.com/moapp/jybase/common" . "bp.jydev.jianyu360.cn/BaseService/biCenter/api/common" "bp.jydev.jianyu360.cn/BaseService/biCenter/api/internal/handler" "bp.jydev.jianyu360.cn/BaseService/biCenter/api/internal/svc" "bp.jydev.jianyu360.cn/BaseService/gateway/core/node" "flag" "fmt" "github.com/zeromicro/go-zero/rest" "os" "os/signal" "syscall" ) var configFile = flag.String("f", "etc/bicenter.yaml", "the config file") func main() { //注册代理服务 closeNotify, err := node.NewNode(C.Gateway.Etcd...).Register(C.Gateway.ServerCode, common.InterfaceToStr(C.Port)) if err != nil { panic(err) } flag.Parse() server := rest.MustNewServer(C.RestConf) defer server.Stop() ctx := svc.NewServiceContext(C) handler.RegisterHandlers(server, ctx) fmt.Printf("Starting server at %s:%d...\n", C.Host, C.Port) server.Start() quit := make(chan os.Signal, 1) signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) <-quit closeNotify() }