Skip to content

Commit

Permalink
Externalize client GUI seed server IP and port
Browse files Browse the repository at this point in the history
  • Loading branch information
victorskl committed Oct 19, 2016
1 parent 196b21a commit 175df91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 6 additions & 3 deletions config/system.properties
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
8 changes: 5 additions & 3 deletions strike-client/src/main/java/strike/controller/Login.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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!
Expand Down

0 comments on commit 175df91

Please sign in to comment.