X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=src%2Fclub%2Fwpia%2Fgigi%2Futil%2FServerConstants.java;h=e2d459ba87cee5f98a07f84e047b7f9dc085b6c7;hb=efa3fa46bca73b26c5ef7142cf6d436fb2e5468b;hp=d95db1b538f2b54a2a72f91df7d0507f98ef3959;hpb=746ad94df76c1ea6ae017f8e56075fcdf0cf0d1f;p=gigi.git diff --git a/src/club/wpia/gigi/util/ServerConstants.java b/src/club/wpia/gigi/util/ServerConstants.java index d95db1b5..e2d459ba 100644 --- a/src/club/wpia/gigi/util/ServerConstants.java +++ b/src/club/wpia/gigi/util/ServerConstants.java @@ -5,6 +5,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; +import club.wpia.gigi.ocsp.OCSPResponder; + public class ServerConstants { public enum Host { @@ -35,7 +37,11 @@ public class ServerConstants { * Hosts the certificate repository for the certificates generated * during NRE. Also not served by Gigi. */ - CRT_REPO("g2.crt"); + CRT_REPO("g2.crt"), + /** + * Hosts the {@link OCSPResponder}. + */ + OCSP_RESPONDER("g2.ocsp"); private final String value; @@ -60,6 +66,16 @@ public class ServerConstants { private static String appName = null; + private static String appIdentifier = null; + + private static String mailSupport; + + private static String mailBoard; + + private static String mailQuiz; + + private static String mailQuizAdmin; + public static void init(Properties conf) { securePort = port = ""; if ( !conf.getProperty("https.port").equals("443")) { @@ -71,7 +87,7 @@ 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 hostnames = new HashMap<>(); for (Host h : Host.values()) { hostnames.put(h, conf.getProperty("name." + h.getConfigName(), h.getHostDefaultPrefix() + "." + suffix)); @@ -81,6 +97,14 @@ public class ServerConstants { if (appName == null) { throw new Error("App name missing"); } + appIdentifier = conf.getProperty("appIdentifier"); + if (appIdentifier == null) { + throw new Error("App identifier missing"); + } + mailSupport = conf.getProperty("mail.support", "support@" + suffix); + mailBoard = conf.getProperty("mail.board", "board@" + suffix); + mailQuiz = conf.getProperty("mail.quiz", "quiz@" + suffix); + mailQuizAdmin = conf.getProperty("mail.quizAdmin", "quiz-admin@" + suffix); } public static String getHostName(Host h) { @@ -128,19 +152,19 @@ public class ServerConstants { } public static String getSupportMailAddress() { - return "support@" + getSuffix(); + return mailSupport; } public static String getBoardMailAddress() { - return "board@" + getSuffix(); + return mailBoard; } public static String getQuizMailAddress() { - return "quiz@" + getSuffix(); + return mailQuiz; } public static String getQuizAdminMailAddress() { - return "quiz-admin@" + getSuffix(); + return mailQuizAdmin; } public static String getAppName() { @@ -150,4 +174,11 @@ public class ServerConstants { return appName; } + public static String getAppIdentifier() { + if (appIdentifier == null) { + throw new Error("AppIdentifier not initialized."); + } + return appIdentifier; + } + }