mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-28 03:57:36 +01:00
Added virtual host support for RabbitMQ (#2877)
This commit is contained in:
parent
a8dfd38fe6
commit
d8aefd23d3
@ -253,6 +253,7 @@ redis:
|
||||
rabbitmq:
|
||||
enabled: false
|
||||
address: localhost
|
||||
vhost: '/'
|
||||
username: 'guest'
|
||||
password: 'guest'
|
||||
|
||||
|
@ -251,6 +251,7 @@ redis:
|
||||
rabbitmq:
|
||||
enabled: false
|
||||
address: localhost
|
||||
vhost: '/'
|
||||
username: 'guest'
|
||||
password: 'guest'
|
||||
|
||||
|
@ -629,6 +629,11 @@ public final class ConfigKeys {
|
||||
*/
|
||||
public static final ConfigKey<String> RABBITMQ_ADDRESS = notReloadable(stringKey("rabbitmq.address", null));
|
||||
|
||||
/**
|
||||
* The virtual host to be used by the rabbitmq server
|
||||
*/
|
||||
public static final ConfigKey<String> RABBITMQ_VIRTUAL_HOST = notReloadable(stringKey("rabbitmq.vhost", "/"));
|
||||
|
||||
/**
|
||||
* The username in use by the rabbitmq server
|
||||
*/
|
||||
|
@ -162,10 +162,11 @@ public class MessagingFactory<P extends LuckPermsPlugin> {
|
||||
|
||||
LuckPermsConfiguration config = getPlugin().getConfiguration();
|
||||
String address = config.get(ConfigKeys.RABBITMQ_ADDRESS);
|
||||
String virtualHost = config.get(ConfigKeys.RABBITMQ_VIRTUAL_HOST);
|
||||
String username = config.get(ConfigKeys.RABBITMQ_USERNAME);
|
||||
String password = config.get(ConfigKeys.RABBITMQ_PASSWORD);
|
||||
|
||||
rabbitmq.init(address, username, password);
|
||||
rabbitmq.init(address, virtualHost, username, password);
|
||||
return rabbitmq;
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class RabbitMQMessenger implements Messenger {
|
||||
this.consumer = consumer;
|
||||
}
|
||||
|
||||
public void init(String address, String username, String password) {
|
||||
public void init(String address, String virtualHost, String username, String password) {
|
||||
String[] addressSplit = address.split(":");
|
||||
String host = addressSplit[0];
|
||||
int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : DEFAULT_PORT;
|
||||
@ -73,6 +73,7 @@ public class RabbitMQMessenger implements Messenger {
|
||||
this.connectionFactory = new ConnectionFactory();
|
||||
this.connectionFactory.setHost(host);
|
||||
this.connectionFactory.setPort(port);
|
||||
this.connectionFactory.setVirtualHost(virtualHost);
|
||||
this.connectionFactory.setUsername(username);
|
||||
this.connectionFactory.setPassword(password);
|
||||
|
||||
|
@ -257,6 +257,7 @@ redis {
|
||||
rabbitmq {
|
||||
enabled = false
|
||||
address = "localhost"
|
||||
vhost = "/"
|
||||
username = "guest"
|
||||
password = "guest"
|
||||
}
|
||||
|
@ -248,6 +248,7 @@ redis:
|
||||
rabbitmq:
|
||||
enabled: false
|
||||
address: localhost
|
||||
vhost: '/'
|
||||
username: 'guest'
|
||||
password: 'guest'
|
||||
|
||||
|
@ -257,6 +257,7 @@ redis {
|
||||
rabbitmq {
|
||||
enabled = false
|
||||
address = "localhost"
|
||||
vhost = "/"
|
||||
username = "guest"
|
||||
password = "guest"
|
||||
}
|
||||
|
@ -242,6 +242,7 @@ redis:
|
||||
rabbitmq:
|
||||
enabled: false
|
||||
address: localhost
|
||||
vhost: '/'
|
||||
username: 'guest'
|
||||
password: 'guest'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user