Add SSL connection option for Redis

feat/data-edit-commands
William 3 years ago
parent 920d2582f5
commit 6719858de1

@ -12,6 +12,7 @@ public class ConfigLoader {
Settings.redisHost = config.getString("redis_settings.host", "localhost"); Settings.redisHost = config.getString("redis_settings.host", "localhost");
Settings.redisPort = config.getInt("redis_settings.port", 6379); Settings.redisPort = config.getInt("redis_settings.port", 6379);
Settings.redisPassword = config.getString("redis_settings.password", ""); Settings.redisPassword = config.getString("redis_settings.password", "");
Settings.redisSSL = config.getBoolean("redis_settings.use_ssl", false);
Settings.syncInventories = config.getBoolean("synchronisation_settings.inventories", true); Settings.syncInventories = config.getBoolean("synchronisation_settings.inventories", true);
Settings.syncEnderChests = config.getBoolean("synchronisation_settings.ender_chests", true); Settings.syncEnderChests = config.getBoolean("synchronisation_settings.ender_chests", true);

@ -2,6 +2,7 @@ redis_settings:
host: 'localhost' host: 'localhost'
port: 6379 port: 6379
password: '' password: ''
use_ssl: false
synchronisation_settings: synchronisation_settings:
inventories: true inventories: true
ender_chests: true ender_chests: true

@ -42,6 +42,7 @@ public class ConfigLoader {
Settings.redisHost = config.getString("redis_settings.host", "localhost"); Settings.redisHost = config.getString("redis_settings.host", "localhost");
Settings.redisPort = config.getInt("redis_settings.port", 6379); Settings.redisPort = config.getInt("redis_settings.port", 6379);
Settings.redisPassword = config.getString("redis_settings.password", ""); Settings.redisPassword = config.getString("redis_settings.password", "");
Settings.redisSSL = config.getBoolean("redis_settings.use_ssl", false);
Settings.dataStorageType = Settings.DataStorageType.valueOf(config.getString("data_storage_settings.database_type", "sqlite").toUpperCase()); Settings.dataStorageType = Settings.DataStorageType.valueOf(config.getString("data_storage_settings.database_type", "sqlite").toUpperCase());
if (Settings.dataStorageType == Settings.DataStorageType.MYSQL) { if (Settings.dataStorageType == Settings.DataStorageType.MYSQL) {

@ -21,6 +21,7 @@ public class Settings {
public static String redisHost; public static String redisHost;
public static int redisPort; public static int redisPort;
public static String redisPassword; public static String redisPassword;
public static boolean redisSSL;
/* /*
* Bungee / Proxy server-only settings * Bungee / Proxy server-only settings

@ -27,13 +27,15 @@ public abstract class RedisListener {
jedisPool = new JedisPool(new JedisPoolConfig(), jedisPool = new JedisPool(new JedisPoolConfig(),
Settings.redisHost, Settings.redisHost,
Settings.redisPort, Settings.redisPort,
0); 0,
Settings.redisSSL);
} else { } else {
jedisPool = new JedisPool(new JedisPoolConfig(), jedisPool = new JedisPool(new JedisPoolConfig(),
Settings.redisHost, Settings.redisHost,
Settings.redisPort, Settings.redisPort,
0, 0,
Settings.redisPassword); Settings.redisPassword,
Settings.redisSSL);
} }
} }

@ -3,6 +3,7 @@ redis_settings:
host: 'localhost' host: 'localhost'
port: 6379 port: 6379
password: '' password: ''
use_ssl: false
data_storage_settings: data_storage_settings:
database_type: 'sqlite' database_type: 'sqlite'
mysql_settings: mysql_settings:

@ -49,7 +49,6 @@ public class ConfigLoader {
public static void loadSettings(ConfigurationNode loadedConfig) throws IllegalArgumentException { public static void loadSettings(ConfigurationNode loadedConfig) throws IllegalArgumentException {
ConfigurationNode config = copyDefaults(loadedConfig); ConfigurationNode config = copyDefaults(loadedConfig);
//ConfigurationNode config = copyDefaults(loadedConfig);
Settings.language = getConfigString(config, "en-gb", "language"); Settings.language = getConfigString(config, "en-gb", "language");
@ -58,6 +57,7 @@ public class ConfigLoader {
Settings.redisHost = getConfigString(config, "localhost", "redis_settings", "host"); Settings.redisHost = getConfigString(config, "localhost", "redis_settings", "host");
Settings.redisPort = getConfigInt(config, 6379, "redis_settings", "port"); Settings.redisPort = getConfigInt(config, 6379, "redis_settings", "port");
Settings.redisPassword = getConfigString(config, "", "redis_settings", "password"); Settings.redisPassword = getConfigString(config, "", "redis_settings", "password");
Settings.redisSSL = getConfigBoolean(config, false, "redis_settings", "use_ssl");
Settings.dataStorageType = Settings.DataStorageType.valueOf(getConfigString(config, "sqlite", "data_storage_settings", "database_type").toUpperCase()); Settings.dataStorageType = Settings.DataStorageType.valueOf(getConfigString(config, "sqlite", "data_storage_settings", "database_type").toUpperCase());
if (Settings.dataStorageType == Settings.DataStorageType.MYSQL) { if (Settings.dataStorageType == Settings.DataStorageType.MYSQL) {

Loading…
Cancel
Save