Skip to content

Commit 4eee7b9

Browse files
Fix client tls dial
1 parent 5194248 commit 4eee7b9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/client/cli/cli.go

+4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ package cli
22

33
import (
44
"context"
5+
"crypto/tls"
56
"errors"
67
"fmt"
78

89
"github.com/denisbrodbeck/machineid"
910
"github.com/sirupsen/logrus"
1011
"github.com/spf13/viper"
1112
"google.golang.org/grpc"
13+
"google.golang.org/grpc/credentials"
1214
"google.golang.org/grpc/credentials/insecure"
1315
"google.golang.org/grpc/encoding/gzip"
1416

@@ -45,6 +47,8 @@ func (cmd *baseCLI) client() (*client.Client, error) {
4547
opts,
4648
grpc.WithTransportCredentials(insecure.NewCredentials()),
4749
)
50+
} else {
51+
opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
4852
}
4953
conn, err := grpc.Dial(cmd.cfg.Host, opts...)
5054
if err != nil {

0 commit comments

Comments
 (0)