From: Niki Roo Date: Thu, 14 May 2020 15:21:23 +0000 (+0200) Subject: fix STOP server X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=commitdiff_plain;h=fcec1f3121e8c0acfe189124ebcf90415c1240e9 fix STOP server --- diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index e48f4f5..c02abb3 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -648,6 +648,18 @@ public class Main { if (port == null) port = Instance.getInstance().getConfig().getInteger(Config.SERVER_PORT); + if (host == null) { + String mode = Instance.getInstance().getConfig() + .getString(Config.SERVER_MODE, "fanfix"); + if ("http".equals(mode)) { + host = "http://localhost"; + } else if ("https".equals(mode)) { + host = "https://localhost"; + } else if ("fanfix".equals(mode)) { + host = "fanfix://localhost"; + } + } + if (port == null) { System.err.println("No port given nor configured in the config file"); exitCode = 15; @@ -1069,7 +1081,7 @@ public class Main { * @param key * the key to contact the Fanfix server * @param host - * the host on which it runs (NULL means localhost) + * the host on which it runs * @param port * the port on which it runs * @@ -1078,7 +1090,7 @@ public class Main { * @throws SSLException * when the key was not accepted */ - private void stopServer(String key, String host, Integer port) + private void stopServer(String key, String host, int port) throws IOException, SSLException { if (host.startsWith("http://") || host.startsWith("https://")) { new WebLibrary(key, host, port).stop();