check for server property

This commit is contained in:
BetaSteward 2010-12-10 10:49:56 -05:00
parent 681a030b8e
commit 7507a97712

View file

@ -85,7 +85,12 @@ public class Main {
} }
} }
Copier.setLoader(classLoader); Copier.setLoader(classLoader);
String ip = config.getServerAddress(); setServerAddress(config.getServerAddress());
server = new ServerImpl(config.getPort(), config.getServerName(), testMode);
}
private static void setServerAddress(String ip) {
try { try {
if (ip.equals("localhost")) { if (ip.equals("localhost")) {
ip = InetAddress.getLocalHost().getHostAddress(); ip = InetAddress.getLocalHost().getHostAddress();
@ -93,10 +98,12 @@ public class Main {
} catch (UnknownHostException ex) { } catch (UnknownHostException ex) {
logger.log(Level.WARNING, "Could not get server address: ", ex); logger.log(Level.WARNING, "Could not get server address: ", ex);
} }
String ipParam = System.getProperty("server");
if (ipParam != null) {
ip = ipParam;
}
System.setProperty("java.rmi.server.hostname", ip); System.setProperty("java.rmi.server.hostname", ip);
logger.info("MAGE server - using address " + ip); logger.info("MAGE server - using address " + ip);
server = new ServerImpl(config.getPort(), config.getServerName(), testMode);
} }
private static Class<?> loadPlugin(Plugin plugin) { private static Class<?> loadPlugin(Plugin plugin) {