Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
commons
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps
commons
Commits
02fb3012
Commit
02fb3012
authored
Mar 18, 2022
by
孙 楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加输出 idc 信息
parent
d6cf818c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
QGConfigManager.java
.../main/java/cn/quantgroup/apollopatch/QGConfigManager.java
+8
-6
QGInjectorCustomizer.java
.../java/cn/quantgroup/apollopatch/QGInjectorCustomizer.java
+1
-0
No files found.
qg-apollo-starter/src/main/java/cn/quantgroup/apollopatch/QGConfigManager.java
View file @
02fb3012
...
@@ -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
);
}
}
...
...
qg-apollo-starter/src/main/java/cn/quantgroup/apollopatch/QGInjectorCustomizer.java
View file @
02fb3012
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment