mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Add redis password support
This commit is contained in:
1 parent
fd542a7f5e
commit
785fabcd3c
2 files changed
+9
-4
No files matched your search
@@ -26,14 +26,18 @@ public class RedisManager {
|
||||
public RedisManager(CarbonChat carbonChat) {
|
||||
|
||||
String host = carbonChat.getConfig().getString("redis.host");
|
||||
String password = carbonChat.getConfig().getString("redis.password");
|
||||
int port = carbonChat.getConfig().getInt("redis.port");
|
||||
int database = carbonChat.getConfig().getInt("redis.database");
|
||||
|
||||
RedisURI uri = RedisURI.Builder.redis(host, port)
|
||||
.withDatabase(database)
|
||||
.build();
|
||||
RedisURI.Builder builder = RedisURI.Builder.redis(host, port)
|
||||
.withDatabase(database);
|
||||
|
||||
this.client = RedisClient.create(uri);
|
||||
if (password != null) {
|
||||
builder.withPassword(password.toCharArray());
|
||||
}
|
||||
|
||||
this.client = RedisClient.create(builder.build());
|
||||
this.connection = client.connectPubSub();
|
||||
this.sync = connection.sync();
|
||||
|
||||
|
||||
@@ -121,4 +121,5 @@ redis:
|
||||
enabled: false
|
||||
host: 'localhost'
|
||||
port: 6379
|
||||
#password: 'password'
|
||||
database: 0
|
||||
Reference in new issue
Block a user