diff --git a/cachecloud-open-common/src/main/java/com/sohu/cache/util/ConstUtils.java b/cachecloud-open-common/src/main/java/com/sohu/cache/util/ConstUtils.java index bac27f54..1bc9ee83 100644 --- a/cachecloud-open-common/src/main/java/com/sohu/cache/util/ConstUtils.java +++ b/cachecloud-open-common/src/main/java/com/sohu/cache/util/ConstUtils.java @@ -54,6 +54,9 @@ public class ConstUtils { // 容量转换 public static final int _1024 = 1024; + + // 表示空 + public static final String NONE = "none"; /** * 机器报警阀值 @@ -137,16 +140,16 @@ public class ConstUtils { /** * 邮箱报警接口 */ - public static String DEFAULT_EMAIL_ALERT_INTERFACE = ""; + public static String DEFAULT_EMAIL_ALERT_INTERFACE = NONE; public static String EMAIL_ALERT_INTERFACE = DEFAULT_EMAIL_ALERT_INTERFACE; /** * 短信报警接口 */ - public static String DEFAULT_MOBILE_ALERT_INTERFACE = ""; + public static String DEFAULT_MOBILE_ALERT_INTERFACE = NONE; public static String MOBILE_ALERT_INTERFACE = DEFAULT_MOBILE_ALERT_INTERFACE; - /**, + /** * maven仓库地址 */ public static String DEFAULT_MAVEN_WAREHOUSE = "http://your_maven_house"; @@ -196,7 +199,7 @@ public static String getRedisMigrateToolCmd() { /** * cookie登录方式所需要的域 */ - public static String DEFAULT_COOKIE_DOMAIN = "none"; + public static String DEFAULT_COOKIE_DOMAIN = NONE; public static String COOKIE_DOMAIN = DEFAULT_COOKIE_DOMAIN; /** diff --git a/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java index c80b8efa..6a6ed0ec 100644 --- a/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java +++ b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java @@ -36,7 +36,7 @@ public boolean sendMail(String title, String content, List emailList) { @Override public boolean sendMail(String title, String content, List emailList, List ccList) { String alertUrl = ConstUtils.EMAIL_ALERT_INTERFACE; - if (StringUtils.isBlank(alertUrl)) { + if (StringUtils.isBlank(alertUrl) || ConstUtils.NONE.equals(alertUrl)) { logger.error("emailAlertInterface url is empty!"); return false; } diff --git a/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java index 5bc1398a..a79c9d58 100644 --- a/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java +++ b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java @@ -37,7 +37,7 @@ public void sendPhoneToAdmin(String message) { @Override public void sendPhone(String message, List phoneList) { String alertUrl = ConstUtils.MOBILE_ALERT_INTERFACE; - if (StringUtils.isBlank(alertUrl)) { + if (StringUtils.isBlank(alertUrl) || ConstUtils.NONE.equals(alertUrl)) { logger.error("mobileAlertInterface url is empty!"); return; } diff --git a/cachecloud-open-common/src/main/java/com/sohu/cache/web/util/LoginUtil.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/util/LoginUtil.java index 10b320a9..d34c0cda 100644 --- a/cachecloud-open-common/src/main/java/com/sohu/cache/web/util/LoginUtil.java +++ b/cachecloud-open-common/src/main/java/com/sohu/cache/web/util/LoginUtil.java @@ -24,7 +24,7 @@ public class LoginUtil { public static boolean passportCheck(String username, String password) { //LDAP登陆地址 String ldapUrl = ConstUtils.LDAP_URL; - if (StringUtils.isBlank(ldapUrl)) { + if (StringUtils.isBlank(ldapUrl) || ConstUtils.NONE.equals(ldapUrl)) { logger.warn("ldap url is empty!!"); return true; } diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/web/service/impl/ConfigServiceImpl.java b/cachecloud-open-web/src/main/java/com/sohu/cache/web/service/impl/ConfigServiceImpl.java index 4dedb43e..fd0ce628 100644 --- a/cachecloud-open-web/src/main/java/com/sohu/cache/web/service/impl/ConfigServiceImpl.java +++ b/cachecloud-open-web/src/main/java/com/sohu/cache/web/service/impl/ConfigServiceImpl.java @@ -148,6 +148,18 @@ public void reloadSystemConfig() { ConstUtils.APP_CLIENT_CONN_THRESHOLD = MapUtils.getIntValue(configMap, "cachecloud.app.client.conn.threshold", ConstUtils.DEFAULT_APP_CLIENT_CONN_THRESHOLD); logger.warn("{}: {}", "ConstUtils.APP_CLIENT_CONN_THRESHOLD", ConstUtils.APP_CLIENT_CONN_THRESHOLD); + //邮件报警接口 + ConstUtils.EMAIL_ALERT_INTERFACE = MapUtils.getString(configMap, "cachecloud.email.alert.interface", ConstUtils.DEFAULT_EMAIL_ALERT_INTERFACE); + logger.warn("{}: {}", "ConstUtils.EMAIL_ALERT_INTERFACE", ConstUtils.EMAIL_ALERT_INTERFACE); + + //短信报警接口 + ConstUtils.MOBILE_ALERT_INTERFACE = MapUtils.getString(configMap, "cachecloud.mobile.alert.interface", ConstUtils.DEFAULT_MOBILE_ALERT_INTERFACE); + logger.warn("{}: {}", "ConstUtils.MOBILE_ALERT_INTERFACE", ConstUtils.MOBILE_ALERT_INTERFACE); + + //LDAP登录地址 + ConstUtils.LDAP_URL = MapUtils.getString(configMap, "cachecloud.ldap.url", ConstUtils.DEFAULT_LDAP_URL); + logger.warn("{}: {}", "ConstUtils.LDAP_URL", ConstUtils.LDAP_URL); + logger.warn("===========ConfigServiceImpl reload config end============"); } diff --git a/script/cachecloud.sql b/script/cachecloud.sql index 56de83d6..18e7039b 100644 --- a/script/cachecloud.sql +++ b/script/cachecloud.sql @@ -874,6 +874,11 @@ insert into system_config(config_key,config_value,info,status,order_id) values(' insert into system_config(config_key,config_value,info,status,order_id) values('cachecloud.base.dir','/opt','cachecloud根目录,要和cachecloud-init.sh脚本中的目录一致',1,21); insert into system_config(config_key,config_value,info,status,order_id) values('cachecloud.app.client.conn.threshold','2000','应用连接数报警阀值',1,22); +insert into system_config(config_key,config_value,info,status,order_id) values('cachecloud.email.alert.interface','none','邮件报警接口(说明:http://cachecloud.github.io 邮件和短信报警接口规范)',1,23); +insert into system_config(config_key,config_value,info,status,order_id) values('cachecloud.mobile.alert.interface','none','短信报警接口(说明:http://cachecloud.github.io 邮件和短信报警接口规范)',1,24); +insert into system_config(config_key,config_value,info,status,order_id) values('cachecloud.ldap.url','none','LDAP接口地址(例如:ldap://ldap.xx.com)',1,25); + + CREATE TABLE `app_data_migrate_status` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', `migrate_machine_ip` varchar(255) NOT NULL COMMENT '迁移工具所在机器ip',