2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-17 01:58:03 +00:00

config log changes, introduction of new env REDISBUNGEE_PROXY_ID

This commit is contained in:
mohammed jasem alaajel 2023-09-12 13:17:05 +04:00
parent 96e620622a
commit c333cf0163
No known key found for this signature in database
4 changed files with 17 additions and 5 deletions

View File

@ -54,7 +54,8 @@ public interface ConfigLoader {
final boolean kickWhenOnline = node.getNode("kick-when-online").getBoolean(true);
String redisPassword = node.getNode("redis-password").getString("");
String redisUsername = node.getNode("redis-username").getString("");
String proxyId = node.getNode("proxy-id").getString("test-1");
String proxyId = node.getNode("proxy-id").getString("proxy-1");
final int maxConnections = node.getNode("max-redis-connections").getInt(10);
List<String> exemptAddresses;
try {
@ -71,9 +72,11 @@ public interface ConfigLoader {
if ((redisUsername.isEmpty() || redisUsername.equals("none"))) {
redisUsername = null;
}
if (useSSL) {
plugin.logInfo("Using ssl");
// env var
String proxyIdFromEnv = System.getenv("REDISBUNGEE_PROXY_ID");
if (proxyIdFromEnv != null) {
plugin.logInfo("Overriding current configured proxy id {} and been set to {} by Environment variable REDISBUNGEE_PROXY_ID", proxyId, proxyIdFromEnv);
proxyId = proxyIdFromEnv;
}
// Configuration sanity checks.
if (proxyId == null || proxyId.isEmpty()) {
@ -88,10 +91,15 @@ public interface ConfigLoader {
}
boolean reconnectToLastServer = node.getNode("reconnect-to-last-server").getBoolean();
boolean handleMotd = node.getNode("handle-motd").getBoolean(true);
plugin.logInfo("handle reconnect to last server: {}", reconnectToLastServer);
plugin.logInfo("handle motd: {}", handleMotd);
RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(proxyId, exemptAddresses, registerLegacyCommands, overrideBungeeCommands, kickWhenOnline, reconnectToLastServer, handleMotd);
Summoner<?> summoner;
RedisBungeeMode redisBungeeMode;
if (useSSL) {
plugin.logInfo("Using ssl");
}
if (node.getNode("cluster-mode-enabled").getBoolean(false)) {
plugin.logInfo("RedisBungee MODE: CLUSTER");
Set<HostAndPort> hostAndPortSet = new HashSet<>();

View File

@ -43,7 +43,9 @@ max-redis-connections: 10
useSSL: false
# An identifier for this BungeeCord / Velocity instance. Will randomly generate if leaving it blank.
proxy-id: "test-1"
# Tip: you can set proxy id using Environment variable REDISBUNGEE_PROXY_ID which will override this config option
# before launch
proxy-id: "proxy-1"
# since version 0.8.0 Internally now uses JedisPooled instead of Jedis, JedisPool.
# which will break compatibility with old plugins that uses RedisBungee JedisPool

View File

@ -44,6 +44,7 @@ tasks {
}
runWaterfall {
waterfallVersion("1.20")
environment.put("REDISBUNGEE_PROXY_ID", "bungeecord-1")
}
compileJava {
options.encoding = Charsets.UTF_8.name()

View File

@ -50,6 +50,7 @@ tasks {
}
runVelocity {
velocityVersion("3.2.0-SNAPSHOT")
environment.put("REDISBUNGEE_PROXY_ID", "velocity-1")
}
compileJava {
options.encoding = Charsets.UTF_8.name()