|
|
@ -23,6 +23,8 @@ import (
|
|
|
|
"github.com/tal-tech/go-zero/core/conf"
|
|
|
|
"github.com/tal-tech/go-zero/core/conf"
|
|
|
|
"github.com/tal-tech/go-zero/zrpc"
|
|
|
|
"github.com/tal-tech/go-zero/zrpc"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
|
|
|
"github.com/tal-tech/go-zero/core/service"
|
|
|
|
|
|
|
|
"google.golang.org/grpc/reflection"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file")
|
|
|
|
var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file")
|
|
|
@ -37,6 +39,13 @@ func main() {
|
|
|
|
|
|
|
|
|
|
|
|
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
|
|
|
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
|
|
|
{{.pkg}}.Register{{.service}}Server(grpcServer, srv)
|
|
|
|
{{.pkg}}.Register{{.service}}Server(grpcServer, srv)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch c.Mode {
|
|
|
|
|
|
|
|
case service.DevMode,service.TestMode:
|
|
|
|
|
|
|
|
reflection.Register(grpcServer)
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
defer s.Stop()
|
|
|
|
defer s.Stop()
|
|
|
|
|
|
|
|
|
|
|
|