Skip to content

Commit

Permalink
add an option to provide cert path to gctcli (thrasher-corp#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rots authored Sep 18, 2020
1 parent a67b5cf commit a66feec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/gctcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
username string
password string
pairDelimiter string
certPath string
)

func jsonOutput(in interface{}) {
Expand All @@ -32,8 +33,7 @@ func jsonOutput(in interface{}) {
}

func setupClient() (*grpc.ClientConn, error) {
targetPath := filepath.Join(common.GetDefaultDataDir(runtime.GOOS), "tls", "cert.pem")
creds, err := credentials.NewClientTLSFromFile(targetPath, "")
creds, err := credentials.NewClientTLSFromFile(certPath, "")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -83,6 +83,12 @@ func main() {
Usage: "the default currency pair delimiter used to standardise currency pair input",
Destination: &pairDelimiter,
},
cli.StringFlag{
Name: "cert",
Value: filepath.Join(common.GetDefaultDataDir(runtime.GOOS), "tls", "cert.pem"),
Usage: "the path to TLS cert of the gRPC server",
Destination: &certPath,
},
}
app.Commands = []cli.Command{
getInfoCommand,
Expand Down

0 comments on commit a66feec

Please sign in to comment.