com.github.javaclub.configcenter.ConfigServerConstants Maven / Gradle / Ivy
The newest version!
/*
* @(#)ConfigServerConstants.java 2021-8-20
*
* Copyright (c) 2021. All Rights Reserved.
*
*/
package com.github.javaclub.configcenter;
import com.github.javaclub.toolbox.ToolBox.Environments;
import com.github.javaclub.toolbox.ToolBox.Strings;
/**
* ConfigServerConstants
*
* @author Gerald Chen
* @version $Id: ConfigServerConstants.java 2021-8-20 10:51:41 Exp $
*/
public interface ConfigServerConstants {
public static class Client {
public static final String JAR_GROUP_ID = "com.github.javaclub";
public static final String JAR_ARTIFACT_ID = "configcenter-client";
public static final String CLIENT_WORKER_KEYS_PULL = "pullAppConfigKeys";
public static final String CLIENT_WORKER_ALARM_MONITOR = "alarmMonitor";
private static volatile boolean clientAppInited;
public static void setClientAppInited(boolean flag) {
clientAppInited = flag;
}
public static boolean isClientAppInited() {
return clientAppInited;
}
}
/**
* 需要在实际项目环境 classpath:server.properties 文件种定义,如:
*
* configserver.enable=true
* configserver.address=192.168.31.216:7001;192.168.31.60:7001;config.idev.com
* configserver.appId=218
* configserver.appKey=zfinlO+DHNM=
*
*/
public static class BootConfig {
public static final String CONFIGSERVER_ENV = "configserver.env";
public static final String CONFIGSERVER_ENABLED = "configserver.enabled";
public static final String CONFIGSERVER_ADDRESS = "configserver.address";
public static final String CONFIGSERVER_APPID = "configserver.appId";
public static final String CONFIGSERVER_APPNAME = "configserver.appName";
public static final String CONFIGSERVER_APPKEY = "configserver.appKey";
public static final String CONFIGSERVER_ONLYONE = "configserver.onlyOne"; // 仅一台机器
public static final String CONFIGSERVER_INTRANET_ALLOWED = "configserver.intranetAllowed"; // 是否允许内网直接请求(默认值:false)
public static final String CONFIGSERVER_SLECTED_FIXED_NODE = "configserver.fixedNode"; // 选择固定的节点
public static final String CONFIGSERVER_ISLOCAL = "configserver.isLocal"; // configserver是否运行于本地
public static final String CONFIGSERVER_CLIENT_POLLING_ALARM = "configserver.clientPollingAlarm"; // client轮询异常多少次后报警
/**
* such as "server.properties"、"config/server.properties"、"conf/server.properties"
*/
public static final String CONFIG_FILE_CLASSPATH = "server.properties";
public static final String CONFIG_FILE_SUFFIX = ".properties";
/**
* Jar包根目录默认配置文件 - ConfigCenter
*/
public static final String JAR_CONFIG_FILE = "configserver-env.properties";
public static final String CONFIGSERVER_PROPERTY_SOURCE_NAME = "ConfigserverPropertySources";
public static final String CONFIGSERVER_BOOTSTRAP_PROPERTY_SOURCE_NAME = "ConfigserverBootstrapPropertySources";
/**
* 多个地址之间的分隔符号
*/
public static final String CONFIGSERVER_ADDRESS_SEPCHAR = ";";
public static String getServerAddressKey() {
if (Environments.isDevEnv()) {
return "dev.configserver";
} else if (Environments.isDailyEnv()) {
return "fat.configserver";
} else if (Environments.isGrayEnv()) {
return "uat.configserver";
} else if (Environments.isProdEnv()) {
return "pro.configserver";
}
return Strings.EMPTY;
}
}
public static class DingTalkConfig {
public static final String DINGTALK_API_URL = "https://oapi.dingtalk.com/robot/send?access_token=";
public static final String CONFIG_KEY_MASTER_AKS = "dingtalk.aks.master";
public static final String CONFIG_KEY_SLAVE_AKS = "dingtalk.aks.slave";
}
public static class DbaConfig {
public static final String APPID = "dbaid";
public static final String APPKEY = "dbakey";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy