diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0445c51..797ed27 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,14 @@ + + * Have you run goformat on the project before submitting? * Have you run go test on the project before submitting? Do all tests pass? diff --git a/README.md b/README.md index 15d0031..76292af 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,10 @@ library has been tested. * [Using the sample client](docs/using-the-sample-client.md) * [Leveraging the library](docs/leveraging-the-library.md) -## To Do -* Create or import a custom transport that uses https://github.com/jmcvetta/napping to improve efficiency +## Projects using gorealis + +* [australis](https://github.com/rdelval/australis) ## Contributions -Contributions are always welcome. Please raise an issue so that the contribution may be discussed before it's made. \ No newline at end of file +Contributions are always welcome. Please raise an issue to discuss a contribution before it is made. + diff --git a/examples/client.go b/examples/client.go index aaee92e..dc71f8e 100644 --- a/examples/client.go +++ b/examples/client.go @@ -30,6 +30,8 @@ import ( ) var cmd, executor, url, clustersConfig, clusterName, updateId, username, password, zkUrl, hostList, role string +var caCertsPath string +var clientKey, clientCert string var CONNECTION_TIMEOUT = 20000 @@ -45,6 +47,9 @@ func init() { flag.StringVar(&zkUrl, "zkurl", "", "zookeeper url") flag.StringVar(&hostList, "hostList", "", "Comma separated list of hosts to operate on") 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 private key to use to connect to Aurora.") flag.Parse() @@ -100,6 +105,14 @@ func main() { clientOptions = append(clientOptions, realis.SchedulerUrl(url)) } + if caCertsPath != "" { + clientOptions = append(clientOptions, realis.Certspath(caCertsPath)) + } + + if clientKey != "" && clientCert != "" { + clientOptions = append(clientOptions, realis.ClientCerts(clientKey, clientCert)) + } + r, err = realis.NewRealisClient(clientOptions...) if err != nil { fmt.Println(err) diff --git a/realis.go b/realis.go index 4fd90bb..c4003e2 100644 --- a/realis.go +++ b/realis.go @@ -266,6 +266,11 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { config.logger.Println("Number of options applied to config: ", len(options)) + // Set a logger if debug has been set to true but no logger has been set + if config.logger == nil && config.debug { + config.logger = log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC) + } + //Set default Transport to JSON if needed. if !config.jsonTransport && !config.binTransport { config.jsonTransport = true