All checks were successful
/ start-services (push) Successful in 2s
/ build-services (app/auth_service/Dockerfile, auth, auth) (push) Successful in 40s
/ build-services (app/ecpm_service/Dockerfile, ecpm, ecpm) (push) Successful in 38s
/ build-services (app/ranking_service/Dockerfile, ranking, ranking) (push) Successful in 40s
/ build-services (app/user_service/Dockerfile, user, user) (push) Successful in 40s
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/internal/server"
|
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/internal/svc"
|
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/ranking"
|
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
|
|
|
"github.com/zeromicro/go-zero/core/service"
|
|
"github.com/zeromicro/go-zero/zrpc"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/grpc/reflection"
|
|
)
|
|
|
|
const ServiceName = "ranking_service"
|
|
|
|
func main() {
|
|
|
|
var c config.Config
|
|
err := config.GetConfig(&c, ServiceName)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
c.RpcServerConf.Name = ServiceName + ".rpc"
|
|
|
|
ctx := svc.NewServiceContext(c)
|
|
|
|
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
|
ranking.RegisterRankingServiceServer(grpcServer, server.NewRankingServiceServer(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.RpcServerConf.ListenOn)
|
|
s.Start()
|
|
}
|