@@ -0,0 +1,61 @@
|
|||||||
|
#----------------------------------------------------------------------
|
||||||
|
# The store is where all the collected data is kept. Different store
|
||||||
|
# types are supported:
|
||||||
|
#
|
||||||
|
# - sqlite: stores stats in an SQLite database
|
||||||
|
# - mysql: stores stats in a MySQL/MariaDB database
|
||||||
|
# - csv: stores stats in local CSV files
|
||||||
|
#
|
||||||
|
# Stores may require configuration of additional properties, such as
|
||||||
|
# file paths or database credentials.
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
store:
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Which type of store to use.
|
||||||
|
#
|
||||||
|
# Changing this value will _not_ result in an automatic conversion
|
||||||
|
# of existing store data. To transfer data to a different store,
|
||||||
|
# make an export of the current store first, then change type and
|
||||||
|
# import the exported data.
|
||||||
|
#
|
||||||
|
type: mysql
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# SQLite store properties
|
||||||
|
#
|
||||||
|
# - filename: name of the database file, relative to plugin folder
|
||||||
|
#
|
||||||
|
#filename: stats.db
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# MySQL/MariaDB store properties
|
||||||
|
#
|
||||||
|
# - host: where the database instance is hosted
|
||||||
|
# - port: database port number
|
||||||
|
# - database: name of the database (must exist!)
|
||||||
|
# - username: username of a valid database user
|
||||||
|
# - password: password of a valid database user
|
||||||
|
# - flags: extra JDBC connection parameters, appended to the URL as-is
|
||||||
|
# (e.g. 'verifyServerCertificate=false&sslmode=required').
|
||||||
|
# Leave blank/omit to append no extra parameters.
|
||||||
|
#
|
||||||
|
host: localhost
|
||||||
|
port: 3306
|
||||||
|
database: mobarena_stats
|
||||||
|
username: mobarena
|
||||||
|
password: 'change-me'
|
||||||
|
flags: 'verifyServerCertificate=false&sslmode=required'
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# CSV store properties
|
||||||
|
#
|
||||||
|
# - folder: where to store data files, relative to plugin folder
|
||||||
|
# - separator: symbol to separate fields and values with
|
||||||
|
#
|
||||||
|
#folder: data
|
||||||
|
#separator: ';'
|
||||||
|
#--------------------------------------------------------------------
|
||||||
@@ -29,11 +29,11 @@ public class MariadbStatsStore {
|
|||||||
String host = config.getString("host", "localhost");
|
String host = config.getString("host", "localhost");
|
||||||
int port = config.getInt("port", 3306);
|
int port = config.getInt("port", 3306);
|
||||||
String database = config.getString("database", "mobarena_stats");
|
String database = config.getString("database", "mobarena_stats");
|
||||||
String ssl = config.getString("ssl", "");
|
String flags = config.getString("flags", "");
|
||||||
|
|
||||||
String url = "jdbc:mariadb://" + host + ":" + port + "/" + database;
|
String url = "jdbc:mariadb://" + host + ":" + port + "/" + database;
|
||||||
|
|
||||||
return ssl.isEmpty() ? url : url + "?" + ssl;
|
return flags.isEmpty() ? url : url + "?" + flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ public class MysqlStatsStore {
|
|||||||
String host = config.getString("host", "localhost");
|
String host = config.getString("host", "localhost");
|
||||||
int port = config.getInt("port", 3306);
|
int port = config.getInt("port", 3306);
|
||||||
String database = config.getString("database", "mobarena_stats");
|
String database = config.getString("database", "mobarena_stats");
|
||||||
String ssl = config.getString("ssl", "");
|
String flags = config.getString("flags", "");
|
||||||
|
|
||||||
String url = "jdbc:mysql://" + host + ":" + port + "/" + database;
|
String url = "jdbc:mysql://" + host + ":" + port + "/" + database;
|
||||||
|
|
||||||
return ssl.isEmpty() ? url : url + "?" + ssl;
|
return flags.isEmpty() ? url : url + "?" + flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,15 +38,15 @@ store:
|
|||||||
# - database: name of the database (must exist!)
|
# - database: name of the database (must exist!)
|
||||||
# - username: username of a valid database user
|
# - username: username of a valid database user
|
||||||
# - password: password of a valid database user
|
# - password: password of a valid database user
|
||||||
# - ssl: extra JDBC connection parameters, appended to the URL as-is
|
# - flags: extra JDBC connection parameters, appended to the URL as-is
|
||||||
# (e.g. 'verifyServerCertificate=false&sslmode=required')
|
# (e.g. 'verifyServerCertificate=false&sslmode=required')
|
||||||
#
|
#
|
||||||
#host: localhost
|
#host: localhost
|
||||||
#port: 3306
|
#port: 3306
|
||||||
#database: ''
|
#database: ''
|
||||||
#username: ''
|
#username: ''
|
||||||
#password: ''
|
#password: ''
|
||||||
#ssl: ''
|
#flags: ''
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class MariadbStatsStoreTest {
|
|||||||
config.set("host", "stats.example.com");
|
config.set("host", "stats.example.com");
|
||||||
config.set("port", 1337);
|
config.set("port", 1337);
|
||||||
config.set("database", "mastats");
|
config.set("database", "mastats");
|
||||||
config.set("ssl", "verifyServerCertificate=false&sslmode=required");
|
config.set("flags", "verifyServerCertificate=false&sslmode=required");
|
||||||
|
|
||||||
String result = MariadbStatsStore.getUrl(config);
|
String result = MariadbStatsStore.getUrl(config);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class MysqlStatsStoreTest {
|
|||||||
config.set("host", "stats.example.com");
|
config.set("host", "stats.example.com");
|
||||||
config.set("port", 1337);
|
config.set("port", 1337);
|
||||||
config.set("database", "mastats");
|
config.set("database", "mastats");
|
||||||
config.set("ssl", "verifyServerCertificate=false&sslmode=required");
|
config.set("flags", "verifyServerCertificate=false&sslmode=required");
|
||||||
|
|
||||||
String result = MysqlStatsStore.getUrl(config);
|
String result = MysqlStatsStore.getUrl(config);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user