Skip to content

Commit

Permalink
email,mobile config data
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosfu committed Jun 18, 2016
1 parent e8147f1 commit 2bae832
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class ConstUtils {

// 容量转换
public static final int _1024 = 1024;

// 表示空
public static final String NONE = "none";

/**
* 机器报警阀值
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public boolean sendMail(String title, String content, List<String> emailList) {
@Override
public boolean sendMail(String title, String content, List<String> emailList, List<String> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void sendPhoneToAdmin(String message) {
@Override
public void sendPhone(String message, List<String> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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============");
}

Expand Down
5 changes: 5 additions & 0 deletions script/cachecloud.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 2bae832

Please sign in to comment.