Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to rethinkdb with a custom certificate #116

Merged
merged 3 commits into from
Jun 23, 2016
Merged

Connect to rethinkdb with a custom certificate #116

merged 3 commits into from
Jun 23, 2016

Conversation

matteosuppo
Copy link
Contributor

Allows a user to specify a custom certificate to connect to rethinkdb (useful when using services such as compose).

Introduces two new environmental variables: RETHINK_TLS_CERT_PATH and RETHINK_TLS_CERT

Fix #114

@matteosuppo
Copy link
Contributor Author

I also corrected a couple of typo

@@ -61,6 +76,28 @@ func (c *RethinkDBConnection) GetSession() *r.Session {
return c.session
}

// loadCertificate reads a certificate either from a file or from a string
func loadCertificate() []byte {
Copy link
Member

@aeneasr aeneasr Jun 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test for this? Also, the name suggests that this is a function for loading any certificate, not just the RETHINK_TLS one. For better testing, you could implement this signature instead:

type importRethinkDBRootCA func(opts *gorethink.ConnectOpts)

Additionally, if a root ca is loaded, there should be a warning using logrus.Warnf(), similar to https://github.com/ory-am/hydra/blob/master/cmd/host.go#L98 or https://github.com/ory-am/hydra/blob/master/cmd/host.go#L135

@aeneasr
Copy link
Member

aeneasr commented Jun 23, 2016

Hey this looks already pretty good :) Please remember to sign your commit - read how

Signed-off-by: Matteo Suppo <matteo.suppo@gmail.com>
Signed-off-by: Matteo Suppo <matteo.suppo@gmail.com>
Signed-off-by: Matteo Suppo <matteo.suppo@gmail.com>
@aeneasr
Copy link
Member

aeneasr commented Jun 23, 2016

perfect, thank you!

@aeneasr aeneasr merged commit 74432b0 into ory:master Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants