From 175df91f4bd456a840617799a46a40855e1f4d72 Mon Sep 17 00:00:00 2001 From: victorskl Date: Wed, 19 Oct 2016 21:46:05 +1100 Subject: [PATCH] Externalize client GUI seed server IP and port --- config/system.properties | 9 ++++++--- strike-client/src/main/java/strike/controller/Login.java | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/system.properties b/config/system.properties index 6c71b43..b7b93d2 100644 --- a/config/system.properties +++ b/config/system.properties @@ -1,12 +1,15 @@ #### Chat System wide properties # keystore=config/keystore/strike_keystore.jks + #### ## Chat Client specific # -client.string=string -client.integer=1 -client.boolean=true +#client.seed.server = 115.146.90.37 +#client.seed.server.port = 4440 +client.seed.server = localhost +client.seed.server.port = 4444 + #### ## Chat Server specific # diff --git a/strike-client/src/main/java/strike/controller/Login.java b/strike-client/src/main/java/strike/controller/Login.java index 8698957..b9ee95e 100644 --- a/strike-client/src/main/java/strike/controller/Login.java +++ b/strike-client/src/main/java/strike/controller/Login.java @@ -7,14 +7,13 @@ import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.control.*; +import javafx.scene.layout.Pane; import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.builder.fluent.Configurations; import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javafx.scene.layout.Pane; - import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -97,10 +96,13 @@ private void initialize() { // Try to create the SSL socket we are going to use for all communication. sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); + String localhost = systemProperties.getString("client.seed.server"); + int port = systemProperties.getInt("client.seed.server.port"); + try { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // This server needs to be running or else we cannot get the server list! - socket = (SSLSocket) sslsocketfactory.createSocket("115.146.90.37", 4440); + socket = (SSLSocket) sslsocketfactory.createSocket(localhost, port); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // To run locally, use this socket instead!