diff --git a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java index 5d9391b..81c02c6 100644 --- a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java +++ b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java @@ -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 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 hostAndPortSet = new HashSet<>(); diff --git a/RedisBungee-API/src/main/resources/config.yml b/RedisBungee-API/src/main/resources/config.yml index d8453a7..8c5eb99 100644 --- a/RedisBungee-API/src/main/resources/config.yml +++ b/RedisBungee-API/src/main/resources/config.yml @@ -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 diff --git a/RedisBungee-Bungee/build.gradle.kts b/RedisBungee-Bungee/build.gradle.kts index bcae98e..8a22c40 100644 --- a/RedisBungee-Bungee/build.gradle.kts +++ b/RedisBungee-Bungee/build.gradle.kts @@ -44,6 +44,7 @@ tasks { } runWaterfall { waterfallVersion("1.20") + environment.put("REDISBUNGEE_PROXY_ID", "bungeecord-1") } compileJava { options.encoding = Charsets.UTF_8.name() diff --git a/RedisBungee-Velocity/build.gradle.kts b/RedisBungee-Velocity/build.gradle.kts index d6ffe4d..7d1a260 100644 --- a/RedisBungee-Velocity/build.gradle.kts +++ b/RedisBungee-Velocity/build.gradle.kts @@ -50,6 +50,7 @@ tasks { } runVelocity { velocityVersion("3.3.0-SNAPSHOT") + environment.put("REDISBUNGEE_PROXY_ID", "velocity-1") } compileJava { options.encoding = Charsets.UTF_8.name()