MCPcopy
hub / github.com/gofr-dev/gofr / AddGRPCServerOptions

Method AddGRPCServerOptions

pkg/gofr/grpc.go:50–58  ·  view source on GitHub ↗

AddGRPCServerOptions allows users to add custom gRPC server options such as TLS configuration, timeouts, interceptors, and other server-specific settings in a single call. Example: // Add TLS credentials and connection timeout in one call creds, _ := credentials.NewServerTLSFromFile("server-cert

(grpcOpts ...grpc.ServerOption)

Source from the content-addressed store, hash-verified

48// This function accepts a variadic list of gRPC server options (grpc.ServerOption) and appends them
49// to the server's configuration. It allows fine-tuning of the gRPC server's behavior during its initialization.
50func (a *App) AddGRPCServerOptions(grpcOpts ...grpc.ServerOption) {
51 if len(grpcOpts) == 0 {
52 a.container.Logger.Debug("no gRPC server options provided")
53 return
54 }
55
56 a.container.Logger.Debugf("adding %d gRPC server options", len(grpcOpts))
57 a.grpcServer.options = append(a.grpcServer.options, grpcOpts...)
58}
59
60// AddGRPCUnaryInterceptors allows users to add custom gRPC interceptors.
61// Example:

Calls 3

appendFunction · 0.85
DebugMethod · 0.65
DebugfMethod · 0.65