diff options
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Configuration.java')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Configuration.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Configuration.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Configuration.java index 8b6caf3d..58134cfc 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Configuration.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/util/Configuration.java @@ -20,6 +20,8 @@ public class Configuration { private static final Logger LOGGER = Logger.getLogger(Configuration.class); private static final DateTimeFormatter subdirDate = DateTimeFormat.forPattern("yy-MM"); + private static final String DEFAULT_WEBSERVER_BIND_ADDRESS_LOCAL = "127.0.0.1"; + private static File vmStoreBasePath; private static File vmStoreProdPath; private static String dbUri; @@ -28,6 +30,7 @@ public class Configuration { private static String masterAddress; private static boolean masterSsl = true; private static int masterPort = 9091; + private static boolean webServerBindLocalhost = true; private static String dbLocationTable; private static SSLContext ctx = null; @@ -56,6 +59,10 @@ public class Configuration { } catch (Exception e) { } + if (!Util.isEmptyString(prop.getProperty("webserver.bindLocalhost"))) { + webServerBindLocalhost = Boolean.parseBoolean(prop.getProperty("webserver.bindLocalhost")); + } + // Currently all fields are mandatory but there might be optional settings in the future return vmStoreBasePath != null && dbUri != null && dbUsername != null && dbPassword != null; } @@ -104,6 +111,19 @@ public class Configuration { return masterPort; } + public static boolean getWebServerBindLocalhost() { + return webServerBindLocalhost; + } + + public static String getWebServerBindAddressLocal() { + if (getWebServerBindLocalhost()) { + return DEFAULT_WEBSERVER_BIND_ADDRESS_LOCAL; + } else { + // do not bind to the localhost address + return null; + } + } + // Dynamically Computed fields public static File getCurrentVmStorePath() { |