mirror of
https://github.com/status-im/migrate.git
synced 2025-02-23 08:18:07 +00:00
Merge pull request #115 from weszeloos/add_support_for_tls_in_cassandra
Add support for TLS on Cassandra.
This commit is contained in:
commit
2fc1610248
@ -22,7 +22,10 @@ system_schema table which comes with 3.X
|
|||||||
| `timeout` | 1 minute | Migration timeout
|
| `timeout` | 1 minute | Migration timeout
|
||||||
| `username` | nil | Username to use when authenticating. |
|
| `username` | nil | Username to use when authenticating. |
|
||||||
| `password` | nil | Password to use when authenticating. |
|
| `password` | nil | Password to use when authenticating. |
|
||||||
|
| `sslcert` | | Cert file location. The file must contain PEM encoded data. |
|
||||||
|
| `sslkey` | | Key file location. The file must contain PEM encoded data. |
|
||||||
|
| `sslrootcert` | | The location of the root certificate file. The file must contain PEM encoded data. |
|
||||||
|
| `sslmode` | | Whether or not to use SSL (disable\|require\|verify-ca\|verify-full) |
|
||||||
|
|
||||||
`timeout` is parsed using [time.ParseDuration(s string)](https://golang.org/pkg/time/#ParseDuration)
|
`timeout` is parsed using [time.ParseDuration(s string)](https://golang.org/pkg/time/#ParseDuration)
|
||||||
|
|
||||||
|
@ -120,6 +120,19 @@ func (c *Cassandra) Open(url string) (database.Driver, error) {
|
|||||||
cluster.Timeout = timeout
|
cluster.Timeout = timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(u.Query().Get("sslmode")) > 0 && len(u.Query().Get("sslrootcert")) > 0 && len(u.Query().Get("sslcert")) > 0 && len(u.Query().Get("sslkey")) > 0 {
|
||||||
|
if u.Query().Get("sslmode") != "disable" {
|
||||||
|
cluster.SslOpts = &gocql.SslOptions{
|
||||||
|
CaPath: u.Query().Get("sslrootcert"),
|
||||||
|
CertPath: u.Query().Get("sslcert"),
|
||||||
|
KeyPath: u.Query().Get("sslkey"),
|
||||||
|
}
|
||||||
|
if u.Query().Get("sslmode") == "verify-full" {
|
||||||
|
cluster.SslOpts.EnableHostVerification = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session, err := cluster.CreateSession()
|
session, err := cluster.CreateSession()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user