Change comments on configs; default ports for all storage backends

This commit is contained in:
bakatrouble 2016-12-25 20:43:36 +03:00 committed by Luck
parent 0abe9598f6
commit f8a77cf809
5 changed files with 38 additions and 19 deletions

View File

@ -148,8 +148,8 @@ group-name-rewrite:
# +------------------------------------------------------------------------+ # # +------------------------------------------------------------------------+ #
# Which storage method the plugin should use. # Which storage method the plugin should use.
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Currently supported: mysql, postgresql, sqlite, h2, json, yaml, mongodb
# Fill out connection info below if you're using MySQL or MongoDB # Fill out connection info below if you're using MySQL, PostgreSQL or MongoDB
storage-method: h2 storage-method: h2
# This block enables support for split datastores. # This block enables support for split datastores.
@ -163,7 +163,11 @@ split-storage:
log: h2 log: h2
data: data:
address: localhost:3306 # Uses standard DB engine port by default
# MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017
# Specify as "host:port" if differs
address: localhost
database: minecraft database: minecraft
username: root username: root
password: '' password: ''
@ -181,9 +185,11 @@ data:
# #
# If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms # If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms
# to poll the database for changes. # to poll the database for changes.
#
# Port 6379 is used by default; set address to "host:port" if differs
redis: redis:
enabled: false enabled: false
address: localhost:6379 address: localhost
password: '' password: ''

View File

@ -90,8 +90,8 @@ group-weight:
# +------------------------------------------------------------------------+ # # +------------------------------------------------------------------------+ #
# Which storage method the plugin should use. # Which storage method the plugin should use.
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Currently supported: mysql, postgresql, sqlite, h2, json, yaml, mongodb
# Fill out connection info below if you're using MySQL or MongoDB # Fill out connection info below if you're using MySQL, PostgreSQL or MongoDB
storage-method: h2 storage-method: h2
# This block enables support for split datastores. # This block enables support for split datastores.
@ -105,7 +105,11 @@ split-storage:
log: h2 log: h2
data: data:
address: localhost:3306 # Uses standard DB engine port by default
# MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017
# Specify as "host:port" if differs
address: localhost
database: minecraft database: minecraft
username: root username: root
password: '' password: ''
@ -123,9 +127,11 @@ data:
# #
# If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms # If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms
# to poll the database for changes. # to poll the database for changes.
#
# Port 6379 is used by default; set address to "host:port" if differs
redis: redis:
enabled: false enabled: false
address: localhost:6379 address: localhost
password: '' password: ''

View File

@ -49,8 +49,9 @@ public class RedisMessaging implements MessagingService {
private LPSub sub; private LPSub sub;
public void init(String address, String password) { public void init(String address, String password) {
String host = address.substring(0, address.indexOf(':')); String[] addressSplit = address.split(":");
int port = Integer.parseInt(address.substring(address.indexOf(":") + 1)); String host = addressSplit[0];
int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : 6379;
if (password.equals("")) { if (password.equals("")) {
jedisPool = new JedisPool(new JedisPoolConfig(), host, port); jedisPool = new JedisPool(new JedisPoolConfig(), host, port);
@ -91,7 +92,7 @@ public class RedisMessaging implements MessagingService {
private final LuckPermsPlugin plugin; private final LuckPermsPlugin plugin;
private final Set<UUID> receivedMsgs = Collections.synchronizedSet(new HashSet<>()); private final Set<UUID> receivedMsgs = Collections.synchronizedSet(new HashSet<>());
public UUID generateId() { UUID generateId() {
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
receivedMsgs.add(uuid); receivedMsgs.add(uuid);
return uuid; return uuid;

View File

@ -139,10 +139,10 @@ public class MongoDBBacking extends AbstractBacking {
} }
} }
ServerAddress address = new ServerAddress( String[] addressSplit = configuration.getAddress().split(":");
configuration.getAddress().split(":")[0], String host = addressSplit[0];
Integer.parseInt(configuration.getAddress().split(":")[1]) int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : 27017;
); ServerAddress address = new ServerAddress(host, port);
if (credential == null) { if (credential == null) {
mongoClient = new MongoClient(address, Collections.emptyList()); mongoClient = new MongoClient(address, Collections.emptyList());

View File

@ -89,8 +89,8 @@ group-weight {
# +------------------------------------------------------------------------+ # # +------------------------------------------------------------------------+ #
# Which storage method the plugin should use. # Which storage method the plugin should use.
# Currently supported: mysql, sqlite, h2, json, yaml, mongodb # Currently supported: mysql, postgresql, sqlite, h2, json, yaml, mongodb
# Fill out connection info below if you're using MySQL or MongoDB # Fill out connection info below if you're using MySQL, PostgreSQL or MongoDB
storage-method="h2" storage-method="h2"
# This block enables support for split datastores. # This block enables support for split datastores.
@ -106,7 +106,11 @@ split-storage {
} }
data { data {
address="localhost:3306" # Uses standard DB engine port by default
# MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017
# Specify as "host:port" if differs
address="localhost"
database="minecraft" database="minecraft"
username="root" username="root"
password="" password=""
@ -125,9 +129,11 @@ data {
# #
# If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms # If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms
# to poll the database for changes. # to poll the database for changes.
#
# Port 6379 is used by default; set address to "host:port" if differs
redis { redis {
enabled=false enabled=false
address="localhost:6379" address="localhost"
password="" password=""
} }