diff --git a/cmd/client/grpc_client.go b/cmd/client/grpc_client.go index 450e47af6..5513eff03 100644 --- a/cmd/client/grpc_client.go +++ b/cmd/client/grpc_client.go @@ -39,7 +39,8 @@ const ( EnvAuthToken = "KETO_BEARER_TOKEN" //nolint:gosec // just the key, not the value EnvAuthority = "KETO_AUTHORITY" - ContextKeyTimeout contextKeys = "timeout" + ContextKeyTimeout contextKeys = "timeout" + ContextKeyDialFunc contextKeys = "dial" ) type connectionDetails struct { @@ -137,6 +138,10 @@ func Conn(ctx context.Context, remote string, details connectionDetails) (*grpc. defer cancel() } + if dial, ok := ctx.Value(ContextKeyDialFunc).(func(context.Context, string) (*grpc.ClientConn, error)); ok { + return dial(ctx, remote) + } + return grpc.DialContext( ctx, remote,