aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2015-10-29 13:22:42 +0300
committerGravatar Vitaly Takmazov2015-10-29 13:22:42 +0300
commit391cb62d29159e1bad56c96be06e4cf527a90746 (patch)
treedb39017d732e738a57cb9f630bcb1a32984a7091
parent5ef8eb20af30b8e3b50bb73fd0835a7f74627356 (diff)
load config from WEB-INF, example config
-rw-r--r--.gitignore1
-rw-r--r--src/main/java/com/juick/http/www/Main.java2
-rw-r--r--src/main/webapp/WEB-INF/juick.conf.example3
3 files changed, 5 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 1e29623a..ec7d29ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ build/*
deps/*
.idea/*
*.iml
+**/juick.conf
diff --git a/src/main/java/com/juick/http/www/Main.java b/src/main/java/com/juick/http/www/Main.java
index 6504a0e4..ced7fb98 100644
--- a/src/main/java/com/juick/http/www/Main.java
+++ b/src/main/java/com/juick/http/www/Main.java
@@ -69,7 +69,7 @@ public class Main extends HttpServlet implements Stream.StreamListener {
super.init();
try {
Properties conf = new Properties();
- conf.load(new FileInputStream("/etc/juick/www.conf"));
+ conf.load(getServletContext().getResourceAsStream("WEB-INF/juick.conf"));
Class.forName("com.mysql.jdbc.Driver");
sql = DriverManager.getConnection("jdbc:mysql://localhost/juick?autoReconnect=true&user=" + conf.getProperty("mysql_username", "") + "&password=" + conf.getProperty("mysql_password", ""));
diff --git a/src/main/webapp/WEB-INF/juick.conf.example b/src/main/webapp/WEB-INF/juick.conf.example
new file mode 100644
index 00000000..93e27434
--- /dev/null
+++ b/src/main/webapp/WEB-INF/juick.conf.example
@@ -0,0 +1,3 @@
+mysql_username=username
+xmpp_password=secret
+sape_user=usertoken