mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-03 00:38:40 +08:00
feat: reflection grpc service (#1107)
* feat: reflection grpc service * feat: reflection grpc service
This commit is contained in:
parent
d1e702e8a3
commit
295ec27e1b
@ -23,6 +23,8 @@ import (
|
||||
"github.com/tal-tech/go-zero/core/conf"
|
||||
"github.com/tal-tech/go-zero/zrpc"
|
||||
"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")
|
||||
@ -37,6 +39,13 @@ func main() {
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
{{.pkg}}.Register{{.service}}Server(grpcServer, srv)
|
||||
|
||||
switch c.Mode {
|
||||
case service.DevMode,service.TestMode:
|
||||
reflection.Register(grpcServer)
|
||||
default:
|
||||
}
|
||||
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user