Add Cassandra username/password properties
Allow Cassandra credentials to be specified using properties. Fixes gh-4431 Closes gh-4432
This commit is contained in:
parent
4254cc46c3
commit
190b0d4fe9
|
@ -55,6 +55,9 @@ public class CassandraAutoConfiguration {
|
|||
Cluster.Builder builder = Cluster.builder()
|
||||
.withClusterName(properties.getClusterName())
|
||||
.withPort(properties.getPort());
|
||||
if (properties.getUsername() != null) {
|
||||
builder.withCredentials(properties.getUsername(), properties.getPassword());
|
||||
}
|
||||
if (properties.getCompression() != null) {
|
||||
builder.withCompression(properties.getCompression());
|
||||
}
|
||||
|
|
|
@ -57,6 +57,16 @@ public class CassandraProperties {
|
|||
*/
|
||||
private int port = ProtocolOptions.DEFAULT_PORT;
|
||||
|
||||
/**
|
||||
* Login user of the server.
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* Login password of the server.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* Compression supported by the Cassandra binary protocol.
|
||||
*/
|
||||
|
@ -139,6 +149,22 @@ public class CassandraProperties {
|
|||
this.port = port;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Compression getCompression() {
|
||||
return this.compression;
|
||||
}
|
||||
|
|
|
@ -476,11 +476,13 @@ content into your application; rather pick only the properties that you need.
|
|||
spring.data.cassandra.keyspace-name= # Keyspace name to use.
|
||||
spring.data.cassandra.load-balancing-policy= # Class name of the load balancing policy.
|
||||
spring.data.cassandra.port= # Port of the Cassandra server.
|
||||
spring.data.cassandra.password= # Login password of the server.
|
||||
spring.data.cassandra.read-timeout-millis= # Socket option: read time out.
|
||||
spring.data.cassandra.reconnection-policy= # Reconnection policy class.
|
||||
spring.data.cassandra.retry-policy= # Class name of the retry policy.
|
||||
spring.data.cassandra.serial-consistency-level= # Queries serial consistency level.
|
||||
spring.data.cassandra.ssl=false # Enable SSL support.
|
||||
spring.data.cassandra.username= # Login user of the server.
|
||||
|
||||
# ELASTICSEARCH ({sc-spring-boot-autoconfigure}/elasticsearch/ElasticsearchProperties.{sc-ext}[ElasticsearchProperties])
|
||||
spring.data.elasticsearch.cluster-name=elasticsearch # Elasticsearch cluster name.
|
||||
|
|
Loading…
Reference in New Issue