Skip to content

Commit 0f26cbe

Browse files
committed
Simplify GPRC dial options
1 parent 99ee72c commit 0f26cbe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: pkg/controller/registry/grpc/source.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,14 @@ func getEnvAny(names ...string) string {
147147
}
148148

149149
func grpcConnection(address string) (*grpc.ClientConn, error) {
150+
dialOptions := []grpc.DialOption{grpc.WithInsecure()}
150151
proxyURL, err := grpcProxyURL(address)
151152
if err != nil {
152153
return nil, err
153154
}
154155

155156
if proxyURL != nil {
156-
return grpc.Dial(address, grpc.WithInsecure(), grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
157+
dialOptions = append(dialOptions, grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
157158
dialer, err := proxy.FromURL(proxyURL, &net.Dialer{})
158159
if err != nil {
159160
return nil, err
@@ -162,7 +163,7 @@ func grpcConnection(address string) (*grpc.ClientConn, error) {
162163
}))
163164
}
164165

165-
return grpc.Dial(address, grpc.WithInsecure())
166+
return grpc.Dial(address, dialOptions...)
166167
}
167168

168169
func (s *SourceStore) Add(key registry.CatalogKey, address string) (*SourceConn, error) {

0 commit comments

Comments
 (0)