package main import ( "flag" "github.com/zeromicro/go-zero/core/logx" "app-cloudep-trade-service/gen_result/pb/trade" "app-cloudep-trade-service/internal/config" couponserviceServer "app-cloudep-trade-service/internal/server/couponservice" inventoryserviceServer "app-cloudep-trade-service/internal/server/inventoryservice" orderserviceServer "app-cloudep-trade-service/internal/server/orderservice" productserviceServer "app-cloudep-trade-service/internal/server/productservice" subscriptionserviceServer "app-cloudep-trade-service/internal/server/subscriptionservice" walletserviceServer "app-cloudep-trade-service/internal/server/walletservice" "app-cloudep-trade-service/internal/svc" "github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/service" "github.com/zeromicro/go-zero/zrpc" "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) var configFile = flag.String("f", "etc/trade.yaml", "the config file") func main() { flag.Parse() var c config.Config conf.MustLoad(*configFile, &c) ctx := svc.NewServiceContext(c) s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { trade.RegisterOrderServiceServer(grpcServer, orderserviceServer.NewOrderServiceServer(ctx)) trade.RegisterWalletServiceServer(grpcServer, walletserviceServer.NewWalletServiceServer(ctx)) trade.RegisterInventoryServiceServer(grpcServer, inventoryserviceServer.NewInventoryServiceServer(ctx)) trade.RegisterProductServiceServer(grpcServer, productserviceServer.NewProductServiceServer(ctx)) trade.RegisterSubscriptionServiceServer(grpcServer, subscriptionserviceServer.NewSubscriptionServiceServer(ctx)) trade.RegisterCouponServiceServer(grpcServer, couponserviceServer.NewCouponServiceServer(ctx)) if c.Mode == service.DevMode || c.Mode == service.TestMode { reflection.Register(grpcServer) } }) defer s.Stop() logx.Infof("Starting rpc server at %s...\n", c.ListenOn) s.Start() }