I have common Utility jar in project. I wanted to add new class say EmailProperties in same. But the properties comes out from Web Server.
So i exposed methods like:
public class EmailEnvProp {
public static String getErrorEnv() {
return System.getProperty("int.log.error")!=null
? System.getProperty("int.log.error") : "ERROR" ; // [PROD] | ERROR
}
public static String getWarnEnv() {
return System.getProperty("int.log.warn")
? System.getProperty("int.log.warn") : "WARN" ; // [PROD] | WARN
}
public static String getInfoEnv() {
return System.getProperty("int.log.info")
? System.getProperty("int.log.info") : "INFO" ; // [PROD] | INFO
}
public static String getToEmail() {
return System.getProperty("integrator.email.to");
}
public static String getFromEmail(){
return System.getProperty("integrator.email.from");
}
public static String getSubject(String env, String msg) {
return env+" | "+msg;
}
}
The system properties are stored in Wildfly Web Server and all 100 Projects (big small) going to use this jar for creating EmailSubject etc and fetching to from from wildfly.
Is it okay to keep server system properties hardcoded above there for common API? If not how this should be handled?
The Wildfly Properties will not get change and have same name. But if wildfly get change it may require further changes. But we know wildfly will be updated but never changed. (But in case project move to some docker then it requires lot of refactoring, so this will also get small change)
Aucun commentaire:
Enregistrer un commentaire