more logical grpc dialing (#463)

This commit is contained in:
Michael Quigley 2024-08-23 13:00:01 -04:00
parent 64c984ffcc
commit a89d8ef178
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -42,10 +42,14 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) {
tui.Error("error getting agent socket", err)
}
opts := []grpc.DialOption{
grpc.WithContextDialer(func(_ context.Context, addr string) (net.Conn, error) {
return net.Dial("unix", addr)
}),
grpc.WithTransportCredentials(insecure.NewCredentials()),
}
resolver.SetDefaultScheme("passthrough")
conn, err := grpc.NewClient("unix", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return net.Dial("unix", agentSocket)
}), grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(agentSocket, opts...)
if err != nil {
tui.Error("error connecting to agent socket", err)
}