aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/ApiServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/ApiServer.java')
-rw-r--r--juick-api/src/main/java/com/juick/api/ApiServer.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/juick-api/src/main/java/com/juick/api/ApiServer.java b/juick-api/src/main/java/com/juick/api/ApiServer.java
index 4d260df8..7f4042af 100644
--- a/juick-api/src/main/java/com/juick/api/ApiServer.java
+++ b/juick-api/src/main/java/com/juick/api/ApiServer.java
@@ -21,6 +21,7 @@ import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import rocks.xmpp.core.XmppException;
import rocks.xmpp.core.session.Extension;
@@ -37,24 +38,21 @@ public class ApiServer implements AutoCloseable {
private ExternalComponent xmpp;
+ @Value("${upload_tmp_dir:'/var/www/juick.com/i/tmp/'}")
public String tmpDir;
+ @Value("${img_path:'/var/www/juick.com/i/'}")
public String imgDir;
-
- private String xmppHost, xmppPassword, xmppJid;
+ @Value("${xmpp_host:'localhost'}")
+ private String xmppHost;
+ @Value("${xmpp_password:'secret'}")
+ private String xmppPassword;
+ @Value("${xmpp_jid:'api.localhost'}")
+ private String xmppJid;
+ @Value("${xmpp_port:5347}")
private int xmppPort;
+ @Value("${xmpp_disabled:false}")
private boolean isXmppDisabled;
-
- public ApiServer(Environment conf) {
- tmpDir = conf.getProperty("upload_tmp_dir", "/var/www/juick.com/i/tmp/");
- imgDir = conf.getProperty("img_path", "/var/www/juick.com/i/");
- isXmppDisabled = BooleanUtils.toBoolean(conf.getProperty("xmpp_disabled"));
- xmppHost = conf.getProperty("xmpp_host", "localhost");
- xmppPort = NumberUtils.toInt(conf.getProperty("xmpp_port", "5347"), 5347);
- xmppJid = conf.getProperty("xmpp_jid", "api.localhost");
- xmppPassword = conf.getProperty("xmpp_password");
- }
-
@PostConstruct
public void init() {
if (!isXmppDisabled) {