Skip to content

Commit

Permalink
Allow setting grpc options on grpc server (dapr#366)
Browse files Browse the repository at this point in the history
Signed-off-by: Joni Collinge <[email protected]>
  • Loading branch information
jjcollinge authored Feb 24, 2023
1 parent 6484b1b commit 7c5ecee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions service/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ func NewService(address string) (s common.Service, err error) {
}

// NewServiceWithListener creates new Service with specific listener.
func NewServiceWithListener(lis net.Listener) common.Service {
return newService(lis)
func NewServiceWithListener(lis net.Listener, opts ...grpc.ServerOption) common.Service {
return newService(lis, opts...)
}

func newService(lis net.Listener) *Server {
func newService(lis net.Listener, opts ...grpc.ServerOption) *Server {
s := &Server{
listener: lis,
invokeHandlers: make(map[string]common.ServiceInvocationHandler),
Expand All @@ -57,7 +57,7 @@ func newService(lis net.Listener) *Server {
authToken: os.Getenv(common.AppAPITokenEnvVar),
}

gs := grpc.NewServer()
gs := grpc.NewServer(opts...)
pb.RegisterAppCallbackServer(gs, s)
pb.RegisterAppCallbackHealthCheckServer(gs, s)
s.grpcServer = gs
Expand Down

0 comments on commit 7c5ecee

Please sign in to comment.