]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/ServerConstants.java
add: notify board if a support role is granted or removed
[gigi.git] / src / org / cacert / gigi / util / ServerConstants.java
index 49f5d050a86054eed7195ea1956afd404f3ad6c3..21bbce98f63e9f439f04e96d5415a79e04e874c9 100644 (file)
@@ -12,17 +12,24 @@ public class ServerConstants {
 
     private static String apiHostName = "api.cacert.local";
 
-    private static String port;
+    private static String securePort, port;
+
+    private static String suffix = "cacert.local";
 
     public static void init(Properties conf) {
-        port = "";
-        if ( !conf.getProperty("port").equals("443")) {
-            port = ":" + conf.getProperty("port");
+        securePort = port = "";
+        if ( !conf.getProperty("https.port").equals("443")) {
+            securePort = ":" + conf.getProperty("https.port");
+        }
+        if ( !conf.getProperty("http.port").equals("80")) {
+            port = ":" + conf.getProperty("http.port");
         }
         wwwHostName = conf.getProperty("name.www");
         secureHostName = conf.getProperty("name.secure");
         staticHostName = conf.getProperty("name.static");
         apiHostName = conf.getProperty("name.api");
+        suffix = conf.getProperty("name.suffix", conf.getProperty("name.www").substring(4));
+
     }
 
     public static String getSecureHostName() {
@@ -42,7 +49,15 @@ public class ServerConstants {
     }
 
     public static String getSecureHostNamePort() {
-        return secureHostName + port;
+        return secureHostName + securePort;
+    }
+
+    public static String getStaticHostNamePortSecure() {
+        return staticHostName + securePort;
+    }
+
+    public static String getWwwHostNamePortSecure() {
+        return wwwHostName + securePort;
     }
 
     public static String getStaticHostNamePort() {
@@ -54,7 +69,33 @@ public class ServerConstants {
     }
 
     public static String getApiHostNamePort() {
-        return apiHostName + port;
+        return apiHostName + securePort;
+    }
+
+    public static int getSecurePort() {
+        if (securePort.isEmpty()) {
+            return 443;
+        }
+        return Integer.parseInt(securePort.substring(1, securePort.length()));
+    }
+
+    public static int getPort() {
+        if (port.isEmpty()) {
+            return 80;
+        }
+        return Integer.parseInt(port.substring(1, port.length()));
+    }
+
+    public static String getSuffix() {
+        return suffix;
+    }
+
+    public static String getSupportMailAddress() {
+        return "support@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", "");
+    }
+
+    public static String getBoardMailAddress() {
+        return "board@" + ServerConstants.getWwwHostName().replaceFirst("^www\\.", "");
     }
 
 }