add an option to provide cert path to gctcli (#559)

This commit is contained in:
Rauno Ots
2020-09-18 02:02:40 +02:00
committed by GitHub
parent a67b5cf715
commit a66feec320

View File

@@ -21,6 +21,7 @@ var (
username string
password string
pairDelimiter string
certPath string
)
func jsonOutput(in interface{}) {
@@ -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
}
@@ -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,