]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/ServerConstants.java
add: detect a quiz-admin directly in gigi
[gigi.git] / src / org / cacert / gigi / util / ServerConstants.java
index 09317c3ec643f8c53dfc16b3b27309b4b7ac2883..73bf9d2ec24ca8a108750052f4f56697f12eb025 100644 (file)
@@ -12,7 +12,7 @@ public class ServerConstants {
 
     private static String apiHostName = "api.cacert.local";
 
-    private static String securePort, port;
+    private static String securePort, port, secureBindPort, bindPort;
 
     private static String suffix = "cacert.local";
 
@@ -24,6 +24,8 @@ public class ServerConstants {
         if ( !conf.getProperty("http.port").equals("80")) {
             port = ":" + conf.getProperty("http.port");
         }
+        secureBindPort = conf.getProperty("https.bindPort", conf.getProperty("https.port"));
+        bindPort = conf.getProperty("http.bindPort", conf.getProperty("http.port"));
         wwwHostName = conf.getProperty("name.www");
         secureHostName = conf.getProperty("name.secure");
         staticHostName = conf.getProperty("name.static");
@@ -48,7 +50,7 @@ public class ServerConstants {
         return apiHostName;
     }
 
-    public static String getSecureHostNamePort() {
+    public static String getSecureHostNamePortSecure() {
         return secureHostName + securePort;
     }
 
@@ -73,6 +75,13 @@ public class ServerConstants {
     }
 
     public static int getSecurePort() {
+        if (secureBindPort != null && !secureBindPort.isEmpty()) {
+            if (secureBindPort.equals("stdin")) {
+                return -1;
+            } else {
+                return Integer.parseInt(secureBindPort);
+            }
+        }
         if (securePort.isEmpty()) {
             return 443;
         }
@@ -80,6 +89,13 @@ public class ServerConstants {
     }
 
     public static int getPort() {
+        if (bindPort != null && !bindPort.isEmpty()) {
+            if (bindPort.equals("stdin")) {
+                return -1;
+            } else {
+                return Integer.parseInt(bindPort);
+            }
+        }
         if (port.isEmpty()) {
             return 80;
         }
@@ -94,4 +110,16 @@ public class ServerConstants {
         return "support@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", "");
     }
 
+    public static String getBoardMailAddress() {
+        return "board@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", "");
+    }
+
+    public static String getQuizMailAddress() {
+        return "quiz@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", "");
+    }
+
+    public static String getQuizAdminMailAddress() {
+        return "quiz-admin@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", "");
+    }
+
 }