com.hn.push.jpush.config.JpushConfig Maven / Gradle / Ivy
package com.hn.push.jpush.config;
import cn.hutool.core.util.StrUtil;
import com.hn.config.HnConfigUtils;
import com.hn.config.exception.ConfigException;
import lombok.Data;
/**
* @author T Wang.
* 2019/08/15
*/
@Data
public class JpushConfig {
/**
*
*/
private final static String CONFIG_KEY = "push.jpush.";
/**
* APP_KEY
*/
public static String APP_KEY;
/**
* MASTER_SECRET
*/
public static String MASTER_SECRET;
/**
* 极光 iOS是区分开发还是生产环境的 一般服务端配置为true
*/
public static boolean IS_PRODUCE;
static {
APP_KEY = HnConfigUtils.getConfig(CONFIG_KEY + "appKey");
MASTER_SECRET = HnConfigUtils.getConfig(CONFIG_KEY + "masterSecret");
String isProduceStr = HnConfigUtils.getConfig(CONFIG_KEY + "isProduce");
IS_PRODUCE = Boolean.parseBoolean(isProduceStr);
if(StrUtil.isBlank(APP_KEY)){
throw new ConfigException("极光推送APP_KEY未配置");
}
if(StrUtil.isBlank(MASTER_SECRET)){
throw new ConfigException("极光推送MASTER_SECRET未配置");
}
if(StrUtil.isBlank(isProduceStr)){
throw new ConfigException("极光推送IS_PRODUCE未配置");
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy