Adding SSL flags to sample client.

This commit is contained in:
Renan DelValle 2018-05-22 16:56:42 -07:00
parent e6b204b9da
commit 4f6a5e9741
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9

View file

@ -31,6 +31,8 @@ import (
) )
var cmd, executor, url, clustersConfig, clusterName, updateId, username, password, zkUrl, hostList, role string var cmd, executor, url, clustersConfig, clusterName, updateId, username, password, zkUrl, hostList, role string
var caCertsPath string
var clientKey, clientCert string
var CONNECTION_TIMEOUT = 20000 var CONNECTION_TIMEOUT = 20000
@ -46,6 +48,9 @@ func init() {
flag.StringVar(&zkUrl, "zkurl", "", "zookeeper url") flag.StringVar(&zkUrl, "zkurl", "", "zookeeper url")
flag.StringVar(&hostList, "hostList", "", "Comma separated list of hosts to operate on") flag.StringVar(&hostList, "hostList", "", "Comma separated list of hosts to operate on")
flag.StringVar(&role, "role", "", "owner role to use") flag.StringVar(&role, "role", "", "owner role to use")
flag.StringVar(&caCertsPath, "caCertsPath", "", "Path to CA certs on local machine.")
flag.StringVar(&clientCert, "clientCert", "", "Client certificate to use to connect to Aurora.")
flag.StringVar(&clientKey, "clientKey", "", "Client key to use to connect to Aurora.")
flag.Parse() flag.Parse()
@ -102,6 +107,10 @@ func main() {
clientOptions = append(clientOptions, realis.SchedulerUrl(url)) clientOptions = append(clientOptions, realis.SchedulerUrl(url))
} }
if clientKey != "" || clientCert != "" || caCertsPath != "" {
clientOptions = append(clientOptions, realis.Certspath(caCertsPath), realis.ClientCerts(clientKey, clientCert))
}
r, err = realis.NewRealisClient(clientOptions...) r, err = realis.NewRealisClient(clientOptions...)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)