Skip to content

Commit 0e63eb7

Browse files
authored
Expose Serve opts with default adapters (#956)
* expose Serve opts with default adapaters * tidy
1 parent ac71ca4 commit 0e63eb7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

backend/serve.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type ServeOpts struct {
5959
GRPCSettings GRPCSettings
6060
}
6161

62-
func asGRPCServeOpts(opts ServeOpts) grpcplugin.ServeOpts {
62+
func GRPCServeOpts(opts ServeOpts) grpcplugin.ServeOpts {
6363
pluginOpts := grpcplugin.ServeOpts{
6464
DiagnosticsServer: newDiagnosticsSDKAdapter(prometheus.DefaultGatherer, opts.CheckHealthHandler),
6565
}
@@ -112,7 +112,7 @@ func defaultGRPCMiddlewares(opts ServeOpts) []grpc.ServerOption {
112112
// Serve starts serving the plugin over gRPC.
113113
func Serve(opts ServeOpts) error {
114114
grpc_prometheus.EnableHandlingTimeHistogram()
115-
pluginOpts := asGRPCServeOpts(opts)
115+
pluginOpts := GRPCServeOpts(opts)
116116
pluginOpts.GRPCServer = func(customOptions []grpc.ServerOption) *grpc.Server {
117117
return grpc.NewServer(grpcServerOptions(opts, customOptions...)...)
118118
}
@@ -163,7 +163,7 @@ func GracefulStandaloneServe(dsopts ServeOpts, info standalone.ServerSettings) e
163163
standalone.FindAndKillCurrentPlugin(info.Dir)
164164

165165
// Start GRPC server
166-
pluginOpts := asGRPCServeOpts(dsopts)
166+
pluginOpts := GRPCServeOpts(dsopts)
167167
if pluginOpts.GRPCServer == nil {
168168
pluginOpts.GRPCServer = func(customOptions []grpc.ServerOption) *grpc.Server {
169169
return grpc.NewServer(grpcServerOptions(dsopts, customOptions...)...)
@@ -265,7 +265,7 @@ func Manage(pluginID string, serveOpts ServeOpts) error {
265265
// TestStandaloneServe starts a gRPC server that is not managed by hashicorp.
266266
// The function returns the gRPC server which should be closed by the consumer.
267267
func TestStandaloneServe(opts ServeOpts, address string) (*grpc.Server, error) {
268-
pluginOpts := asGRPCServeOpts(opts)
268+
pluginOpts := GRPCServeOpts(opts)
269269
if pluginOpts.GRPCServer == nil {
270270
pluginOpts.GRPCServer = func(customOptions []grpc.ServerOption) *grpc.Server {
271271
return grpc.NewServer(grpcServerOptions(opts, customOptions...)...)

0 commit comments

Comments
 (0)