You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/03/25 09:27:04 UTC
[servicecomb-java-chassis] branch master updated: change kie label
env to environment
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 6cef5fe change kie label env to environment
6cef5fe is described below
commit 6cef5feb94807a246611dc213ba23512def06dc6
Author: GuoYL <gy...@gmail.com>
AuthorDate: Mon Mar 23 20:55:22 2020 +0800
change kie label env to environment
---
.../servicecomb/config/kie/client/KieUtil.java | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/KieUtil.java b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/KieUtil.java
index 1e91d37..fd6fd1a 100644
--- a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/KieUtil.java
+++ b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/KieUtil.java
@@ -39,8 +39,17 @@ import org.springframework.core.io.ByteArrayResource;
import org.springframework.util.StringUtils;
public class KieUtil {
+
private static final Logger LOGGER = LoggerFactory.getLogger(KieUtil.class);
+ private static final String LABEL_ENV = "environment";
+
+ private static final String LABEL_APP = "app";
+
+ private static final String LABEL_SERVICE = "service";
+
+ private static final String LABEL_VERSION = "version";
+
public static String encrypt(String dataStr) {
MessageDigest messageDigest = null;
String result = "";
@@ -62,20 +71,19 @@ public class KieUtil {
List<KVDoc> versionList = new ArrayList<>();
for (KVDoc kvDoc : resp.getData()) {
Map<String, String> labelsMap = kvDoc.getLabels();
- //todo:how to deal env
- if (labelsMap.containsKey("app") && labelsMap.get("app")
+ if (labelsMap.containsKey(LABEL_APP) && labelsMap.get(LABEL_APP)
.equals(KieConfig.INSTANCE.getAppName())
- && labelsMap.containsKey("env") && labelsMap.get("env")
+ && labelsMap.containsKey(LABEL_ENV) && labelsMap.get(LABEL_ENV)
.equals(KieConfig.INSTANCE.getEnvironment())) {
- if (!labelsMap.containsKey("service")) {
+ if (!labelsMap.containsKey(LABEL_SERVICE)) {
appList.add(kvDoc);
}
- if (labelsMap.containsKey("service") && labelsMap.get("service")
+ if (labelsMap.containsKey(LABEL_SERVICE) && labelsMap.get(LABEL_SERVICE)
.equals(KieConfig.INSTANCE.getServiceName())) {
- if (!kvDoc.getLabels().containsKey("version")) {
+ if (!kvDoc.getLabels().containsKey(LABEL_VERSION)) {
serviceList.add(kvDoc);
}
- if (labelsMap.containsKey("version") && labelsMap.get("version")
+ if (labelsMap.containsKey(LABEL_VERSION) && labelsMap.get(LABEL_VERSION)
.equals(KieConfig.INSTANCE.getServiceName())) {
versionList.add(kvDoc);
}