let pass custom grpc dial opts (#2144)

This commit is contained in:
wasaga 2021-04-27 18:26:27 -04:00 committed by GitHub
parent 7973ab43fe
commit 1b698053f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,7 @@ type Options struct {
}
// NewGRPCClientConn returns a new gRPC pomerium service client connection.
func NewGRPCClientConn(opts *Options) (*grpc.ClientConn, error) {
func NewGRPCClientConn(opts *Options, other ...grpc.DialOption) (*grpc.ClientConn, error) {
ctx := context.TODO()
if len(opts.Addrs) == 0 {
return nil, errors.New("internal/grpc: connection address required")
@ -105,6 +105,8 @@ func NewGRPCClientConn(opts *Options) (*grpc.ClientConn, error) {
grpc.WithDisableServiceConfig(),
}
dialOptions = append(dialOptions, other...)
if opts.WithInsecure {
log.Info(ctx).Str("addr", connAddr).Msg("internal/grpc: grpc with insecure")
dialOptions = append(dialOptions, grpc.WithInsecure())