aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/CrosspostComponent.java9
-rw-r--r--src/main/java/com/juick/PushComponent.java2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/juick/CrosspostComponent.java b/src/main/java/com/juick/CrosspostComponent.java
index 73791c5ee..4c6a50026 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);
}
diff --git a/src/main/java/com/juick/PushComponent.java b/src/main/java/com/juick/PushComponent.java
index 9de598f31..f2c1ee740 100644
--- a/src/main/java/com/juick/PushComponent.java
+++ b/src/main/java/com/juick/PushComponent.java
@@ -76,7 +76,7 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe
public void run() {
Properties conf = new Properties();
try {
- conf.load(sce.getServletContext().getResourceAsStream("WEB-INF/push.conf"));
+ conf.load(sce.getServletContext().getResourceAsStream("WEB-INF/juick.conf"));
GCMSender = new Sender(conf.getProperty("gcm_key"));
setupSql(conf.getProperty("mysql_host"), conf.getProperty("mysql_username"),