mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Add cassandra authenticator mode
This commit is contained in:
parent
370a98cf6b
commit
ed7816681a
|
@ -28,11 +28,16 @@ func (store *CassandraStore) Initialize(configuration util.Configuration, prefix
|
||||||
return store.initialize(
|
return store.initialize(
|
||||||
configuration.GetString(prefix+"keyspace"),
|
configuration.GetString(prefix+"keyspace"),
|
||||||
configuration.GetStringSlice(prefix+"hosts"),
|
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...)
|
store.cluster = gocql.NewCluster(hosts...)
|
||||||
|
if username != "" && password != "" {
|
||||||
|
store.cluster.Authenticator = gocql.PasswordAuthenticator{Username: username, Password: password}
|
||||||
|
}
|
||||||
store.cluster.Keyspace = keyspace
|
store.cluster.Keyspace = keyspace
|
||||||
store.cluster.Consistency = gocql.LocalQuorum
|
store.cluster.Consistency = gocql.LocalQuorum
|
||||||
store.session, err = store.cluster.CreateSession()
|
store.session, err = store.cluster.CreateSession()
|
||||||
|
|
Loading…
Reference in a new issue