Compare commits
1
Commits
1.0
...
6f74026514
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f74026514 |
@@ -29,11 +29,11 @@ public class MariadbStatsStore {
|
||||
String host = config.getString("host", "localhost");
|
||||
int port = config.getInt("port", 3306);
|
||||
String database = config.getString("database", "mobarena_stats");
|
||||
boolean ssl = config.getBoolean("ssl", false);
|
||||
String ssl = config.getString("ssl", "");
|
||||
|
||||
String params = "useSSL=" + ssl;
|
||||
String url = "jdbc:mariadb://" + host + ":" + port + "/" + database;
|
||||
|
||||
return "jdbc:mariadb://" + host + ":" + port + "/" + database + "?" + params;
|
||||
return ssl.isEmpty() ? url : url + "?" + ssl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ public class MysqlStatsStore {
|
||||
String host = config.getString("host", "localhost");
|
||||
int port = config.getInt("port", 3306);
|
||||
String database = config.getString("database", "mobarena_stats");
|
||||
boolean ssl = config.getBoolean("ssl", false);
|
||||
String ssl = config.getString("ssl", "");
|
||||
|
||||
String params = "useSSL=" + ssl;
|
||||
String url = "jdbc:mysql://" + host + ":" + port + "/" + database;
|
||||
|
||||
return "jdbc:mysql://" + host + ":" + port + "/" + database + "?" + params;
|
||||
return ssl.isEmpty() ? url : url + "?" + ssl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,14 +38,15 @@ store:
|
||||
# - database: name of the database (must exist!)
|
||||
# - username: username of a valid database user
|
||||
# - password: password of a valid database user
|
||||
# - ssl: whether to use SSL for database connections
|
||||
# - ssl: extra JDBC connection parameters, appended to the URL as-is
|
||||
# (e.g. 'verifyServerCertificate=false&sslmode=required')
|
||||
#
|
||||
#host: localhost
|
||||
#port: 3306
|
||||
#database: ''
|
||||
#username: ''
|
||||
#password: ''
|
||||
#ssl: false
|
||||
#ssl: ''
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -16,7 +16,7 @@ class MariadbStatsStoreTest {
|
||||
|
||||
String result = MariadbStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mariadb://localhost:3306/mobarena_stats?useSSL=false";
|
||||
String expected = "jdbc:mariadb://localhost:3306/mobarena_stats";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class MariadbStatsStoreTest {
|
||||
config.set("host", "stats.example.com");
|
||||
config.set("port", 1337);
|
||||
config.set("database", "mastats");
|
||||
config.set("ssl", true);
|
||||
config.set("ssl", "verifyServerCertificate=false&sslmode=required");
|
||||
|
||||
String result = MariadbStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mariadb://stats.example.com:1337/mastats?useSSL=true";
|
||||
String expected = "jdbc:mariadb://stats.example.com:1337/mastats?verifyServerCertificate=false&sslmode=required";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class MysqlStatsStoreTest {
|
||||
|
||||
String result = MysqlStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mysql://localhost:3306/mobarena_stats?useSSL=false";
|
||||
String expected = "jdbc:mysql://localhost:3306/mobarena_stats";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ class MysqlStatsStoreTest {
|
||||
config.set("host", "stats.example.com");
|
||||
config.set("port", 1337);
|
||||
config.set("database", "mastats");
|
||||
config.set("ssl", true);
|
||||
config.set("ssl", "verifyServerCertificate=false&sslmode=required");
|
||||
|
||||
String result = MysqlStatsStore.getUrl(config);
|
||||
|
||||
String expected = "jdbc:mysql://stats.example.com:1337/mastats?useSSL=true";
|
||||
String expected = "jdbc:mysql://stats.example.com:1337/mastats?verifyServerCertificate=false&sslmode=required";
|
||||
assertThat(result, equalTo(expected));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user