package main import ( "flag" "fmt" "code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product" "code.30cm.net/digimon/app-cloudep-product-service/internal/config" category_serviceServer "code.30cm.net/digimon/app-cloudep-product-service/internal/server/category_service" kyc_serviceServer "code.30cm.net/digimon/app-cloudep-product-service/internal/server/kyc_service" product_item_serviceServer "code.30cm.net/digimon/app-cloudep-product-service/internal/server/product_item_service" tag_serviceServer "code.30cm.net/digimon/app-cloudep-product-service/internal/server/tag_service" "code.30cm.net/digimon/app-cloudep-product-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/product.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) { product.RegisterCategory_ServiceServer(grpcServer, category_serviceServer.NewCategoryServiceServer(ctx)) product.RegisterTag_ServiceServer(grpcServer, tag_serviceServer.NewTagServiceServer(ctx)) product.RegisterKyc_ServiceServer(grpcServer, kyc_serviceServer.NewKycServiceServer(ctx)) product.RegisterProduct_Item_ServiceServer(grpcServer, product_item_serviceServer.NewProductItemServiceServer(ctx)) if c.Mode == service.DevMode || c.Mode == service.TestMode { reflection.Register(grpcServer) } }) defer s.Stop() fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) s.Start() }