Commit 02fb3012 authored by 孙 楠's avatar 孙 楠

增加输出 idc 信息

parent d6cf818c
...@@ -22,15 +22,15 @@ public class QGConfigManager extends DefaultConfigManager { ...@@ -22,15 +22,15 @@ public class QGConfigManager extends DefaultConfigManager {
public QGConfigManager() { public QGConfigManager() {
super(); super();
String env = Foundation.server().getEnvType(); String env = Foundation.server().getEnvType();
String idc = Foundation.server().getDataCenter();
boolean isPro = Env.PRO.name().equalsIgnoreCase(env); boolean isPro = Env.PRO.name().equalsIgnoreCase(env);
//如果是生产环境, 我也啥都不干. 太吓人了.
if (isPro) { if (isPro) {
log.info("哇, 生产环境. 配置中心静悄悄. 什么都不敢做."); log.info("Env={} DataCenter={} Apollo 生产环境加载", env, idc);
return; return;
} }
String namespace = System.getProperty("NAMESPACE"); String namespace = System.getProperty("NAMESPACE");
if (namespace == null) { if (namespace == null) {
log.info("你好像没有配置 NAMESPACE 哦?你不打算连接到 kubernetes 内部么?"); log.info("非生产环境需要配置 NAMESPACE");
return; return;
} }
String eosHost = System.getProperty("eos_server_host", "http://eos.quantgroups.com/"); String eosHost = System.getProperty("eos_server_host", "http://eos.quantgroups.com/");
...@@ -39,13 +39,15 @@ public class QGConfigManager extends DefaultConfigManager { ...@@ -39,13 +39,15 @@ public class QGConfigManager extends DefaultConfigManager {
HttpResponse<KubeEnvInfo> mapHttpResponse = httpClient.doGet(httpRequest, KubeEnvInfo.class); HttpResponse<KubeEnvInfo> mapHttpResponse = httpClient.doGet(httpRequest, KubeEnvInfo.class);
KubeEnvInfo body = mapHttpResponse.getBody(); KubeEnvInfo body = mapHttpResponse.getBody();
if (body != null && body.success) { if (body != null && body.success) {
log.info("Env={} Namespace={} Kubernetes 的环境变量已经注入, " +
"您可以放心的在 Kubernetes 之外启动你的服务了", env, namespace); log.info("Env={} DataCenter={} Namespace={} Kubernetes 的环境变量已经注入, " +
"您可以放心的在 Kubernetes 之外启动你的服务了", env, idc, namespace);
Properties properties = System.getProperties(); Properties properties = System.getProperties();
properties.putAll(body.details); properties.putAll(body.details);
return; return;
} }
log.error("Env={} Namespace={} eos server 返回异常, serverInfo:{} ,body:{}", env, namespace, eosHost, body); log.error("Env={} DataCenter={} Namespace={} eos server 返回异常, serverInfo:{} ,body:{}",
env, idc, namespace, eosHost, body);
} }
......
...@@ -5,6 +5,7 @@ import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer; ...@@ -5,6 +5,7 @@ import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer;
/** /**
* @author sunnan * @author sunnan
* @since 2022-03-18
*/ */
public class QGInjectorCustomizer implements ApolloInjectorCustomizer { public class QGInjectorCustomizer implements ApolloInjectorCustomizer {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment