aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/CrosspostComponent.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/CrosspostComponent.java')
-rw-r--r--src/main/java/com/juick/CrosspostComponent.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/juick/CrosspostComponent.java b/src/main/java/com/juick/CrosspostComponent.java
index 73791c5e..4c6a5002 100644
--- a/src/main/java/com/juick/CrosspostComponent.java
+++ b/src/main/java/com/juick/CrosspostComponent.java
@@ -82,7 +82,8 @@ public class CrosspostComponent implements ServletContextListener, Stream.Strea
twitter_consumer_key = conf.getProperty("twitter_consumer_key", "");
twitter_consumer_secret = conf.getProperty("twitter_consumer_secret", "");
- setupSql(conf.getProperty("mysql_username", ""), conf.getProperty("mysql_password", ""));
+ setupSql(conf.getProperty("mysql_host"), conf.getProperty("mysql_username"),
+ conf.getProperty("mysql_password", ""), conf.getProperty("mysql_database", ""));
setupXmppComponent(conf.getProperty("xmpp_password", ""));
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
@@ -97,9 +98,11 @@ public class CrosspostComponent implements ServletContextListener, Stream.Strea
logger.info("component destroyed");
}
- public void setupSql(String username, String password) {
+ public void setupSql(String host, String username, String password, String database) {
try {
- sql = DriverManager.getConnection("jdbc:mysql://localhost/juick?autoReconnect=true&user=" + username + "&password=" + password);
+ sql = DriverManager.getConnection(
+ String.format("jdbc:mysql://%s/%s?autoReconnect=true&user=%s&password=%s",
+ host, database, username, password));
} catch (SQLException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
}