aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2020-09-24 21:30:20 -0700
committerGitHub <noreply@github.com>2020-09-24 21:30:20 -0700
commitb1ac324c448d345f7bfb6a70892e9f0fc05f06f6 (patch)
tree2ffd2e1cb0745cc6d80486e7bb90056d076b1f90
parent043b0631369bec00b33eb53cdf2cdef3eced006c (diff)
parented7816681aae57569c64fc0182364ddbc116a3fa (diff)
downloadseaweedfs-b1ac324c448d345f7bfb6a70892e9f0fc05f06f6.tar.xz
seaweedfs-b1ac324c448d345f7bfb6a70892e9f0fc05f06f6.zip
Merge pull request #1490 from hilimd/master
Add cassandra authenticator mode
-rw-r--r--weed/filer/cassandra/cassandra_store.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/weed/filer/cassandra/cassandra_store.go b/weed/filer/cassandra/cassandra_store.go
index 250db629a..ae8cb7a86 100644
--- a/weed/filer/cassandra/cassandra_store.go
+++ b/weed/filer/cassandra/cassandra_store.go
@@ -28,11 +28,16 @@ func (store *CassandraStore) Initialize(configuration util.Configuration, prefix
return store.initialize(
configuration.GetString(prefix+"keyspace"),
configuration.GetStringSlice(prefix+"hosts"),
+ configuration.GetString(prefix+"username"),
+ configuration.GetString(prefix+"password"),
)
}
-func (store *CassandraStore) initialize(keyspace string, hosts []string) (err error) {
+func (store *CassandraStore) initialize(keyspace string, hosts []string, username string, password string) (err error) {
store.cluster = gocql.NewCluster(hosts...)
+ if username != "" && password != "" {
+ store.cluster.Authenticator = gocql.PasswordAuthenticator{Username: username, Password: password}
+ }
store.cluster.Keyspace = keyspace
store.cluster.Consistency = gocql.LocalQuorum
store.session, err = store.cluster.CreateSession()