diff --git a/context.go b/context.go deleted file mode 100644 index 6113d6d..0000000 --- a/context.go +++ /dev/null @@ -1,16 +0,0 @@ -package grpc - -import ( - "context" - - "github.com/unistack-org/micro/v3/server" -) - -func setServerOption(k, v interface{}) server.Option { - return func(o *server.Options) { - if o.Context == nil { - o.Context = context.Background() - } - o.Context = context.WithValue(o.Context, k, v) - } -} diff --git a/options.go b/options.go index 3501abb..a21d26f 100644 --- a/options.go +++ b/options.go @@ -32,7 +32,7 @@ func Codec(contentType string, c encoding.Codec) server.Option { // Options to be used to configure gRPC options func Options(opts ...grpc.ServerOption) server.Option { - return setServerOption(grpcOptions{}, opts) + return server.SetOption(grpcOptions{}, opts) } // @@ -40,10 +40,10 @@ func Options(opts ...grpc.ServerOption) server.Option { // send. Default maximum message size is 4 MB. // func MaxMsgSize(s int) server.Option { - return setServerOption(maxMsgSizeKey{}, s) + return server.SetOption(maxMsgSizeKey{}, s) } // Reflection enables reflection support in grpc server func Reflection(b bool) server.Option { - return setServerOption(reflectionKey{}, b) + return server.SetOption(reflectionKey{}, b) }