Skip to content

Commit

Permalink
feat: make server options configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zw-liu committed Jan 4, 2024
1 parent 520eed2 commit 45ded2d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ type GrpcServer struct {
listener *net.Listener
}

var globalServerOptions []grpc.ServerOption

func SetGlobalServerOptions(options ...grpc.ServerOption) {
globalServerOptions = options
}

func (g GrpcServer) Server() *grpc.Server {
return g.server
}
Expand Down Expand Up @@ -63,6 +69,7 @@ func (g *GrpcServer) Shutdown() {
}

func (g *GrpcServer) Configure(opt ...grpc.ServerOption) {
opt = append(globalServerOptions, opt...)
grpc := grpc.NewServer(opt...)
reflection.Register(grpc)
g.server = grpc
Expand Down

0 comments on commit 45ded2d

Please sign in to comment.