drop AuthTLS option and use server TLSConfig option

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-04-20 12:22:43 +03:00
parent b0cad975e4
commit 683eb62973
2 changed files with 2 additions and 11 deletions

View File

@ -188,10 +188,8 @@ func (g *grpcServer) getMaxMsgSize() int {
}
func (g *grpcServer) getCredentials() credentials.TransportCredentials {
if g.opts.Context != nil {
if v, ok := g.opts.Context.Value(tlsAuth{}).(*tls.Config); ok && v != nil {
return credentials.NewTLS(v)
}
if g.opts.TLSConfig != nil {
return credentials.NewTLS(g.opts.TLSConfig)
}
return nil
}

View File

@ -2,7 +2,6 @@ package grpc
import (
"context"
"crypto/tls"
"github.com/unistack-org/micro/v3/server"
"google.golang.org/grpc"
@ -12,7 +11,6 @@ import (
type codecsKey struct{}
type grpcOptions struct{}
type maxMsgSizeKey struct{}
type tlsAuth struct{}
type reflectionKey struct{}
// gRPC Codec to be used to encode/decode requests for a given content type
@ -30,11 +28,6 @@ func Codec(contentType string, c encoding.Codec) server.Option {
}
}
// AuthTLS should be used to setup a secure authentication using TLS
func AuthTLS(t *tls.Config) server.Option {
return setServerOption(tlsAuth{}, t)
}
// Options to be used to configure gRPC options
func Options(opts ...grpc.ServerOption) server.Option {
return setServerOption(grpcOptions{}, opts)