]> WPIA git - gigi.git/blobdiff - src/club/wpia/gigi/util/ServerConstants.java
Merge "fix: Avoid leaking the SSL sockets"
[gigi.git] / src / club / wpia / gigi / util / ServerConstants.java
index becd77e65d9662afa5328eb9c4d0cedf7709cc48..3fd2e70e7f57a72aefff38847c811f84ab0cf7da 100644 (file)
@@ -58,6 +58,10 @@ public class ServerConstants {
 
     private static String suffix = "wpia.local";
 
+    private static String appName = null;
+
+    private static String appIdentifier = null;
+
     public static void init(Properties conf) {
         securePort = port = "";
         if ( !conf.getProperty("https.port").equals("443")) {
@@ -69,12 +73,20 @@ public class ServerConstants {
         secureBindPort = conf.getProperty("https.bindPort", conf.getProperty("https.port"));
         bindPort = conf.getProperty("http.bindPort", conf.getProperty("http.port"));
 
-        suffix = conf.getProperty("name.suffix", conf.getProperty("name.www", "www.wpia.local").substring(4));
+        suffix = conf.getProperty("name.suffix", "wpia.local");
         HashMap<Host, String> hostnames = new HashMap<>();
         for (Host h : Host.values()) {
             hostnames.put(h, conf.getProperty("name." + h.getConfigName(), h.getHostDefaultPrefix() + "." + suffix));
         }
         ServerConstants.hostnames = Collections.unmodifiableMap(hostnames);
+        appName = conf.getProperty("appName");
+        if (appName == null) {
+            throw new Error("App name missing");
+        }
+        appIdentifier = conf.getProperty("appIdentifier");
+        if (appIdentifier == null) {
+            throw new Error("App identifier missing");
+        }
     }
 
     public static String getHostName(Host h) {
@@ -137,4 +149,18 @@ public class ServerConstants {
         return "quiz-admin@" + getSuffix();
     }
 
+    public static String getAppName() {
+        if (appName == null) {
+            throw new Error("AppName not initialized.");
+        }
+        return appName;
+    }
+
+    public static String getAppIdentifier() {
+        if (appIdentifier == null) {
+            throw new Error("AppIdentifier not initialized.");
+        }
+        return appIdentifier;
+    }
+
 }