You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2022/11/12 05:48:08 UTC
[karaf-minho] branch main updated: Fix the envKey in Config.java (#11)
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/karaf-minho.git
The following commit(s) were added to refs/heads/main by this push:
new a2cebba Fix the envKey in Config.java (#11)
a2cebba is described below
commit a2cebba5542e014e7afa6a6489acc6671502b636
Author: XieYichao <xi...@outlook.com>
AuthorDate: Sat Nov 12 13:48:03 2022 +0800
Fix the envKey in Config.java (#11)
* Fix the envKey in Config.java
* Make pattern for envKey static.
---
boot/src/main/java/org/apache/karaf/minho/boot/config/Config.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/boot/src/main/java/org/apache/karaf/minho/boot/config/Config.java b/boot/src/main/java/org/apache/karaf/minho/boot/config/Config.java
index 5c5a1a8..37588e6 100644
--- a/boot/src/main/java/org/apache/karaf/minho/boot/config/Config.java
+++ b/boot/src/main/java/org/apache/karaf/minho/boot/config/Config.java
@@ -23,10 +23,13 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Pattern;
@Data
public class Config {
+ private static Pattern envKeyPattern = Pattern.compile("\\.");
+
private Map<String, String> properties = new HashMap<>();
private List<Profile> profiles = new ArrayList<>();
private List<Application> applications = new ArrayList<>();
@@ -50,7 +53,7 @@ public class Config {
}
protected static String getProperty(String key, Map<String, String> properties, String defaultValue) {
- String envKey = key.replaceAll(".", "_").toUpperCase();
+ String envKey = envKeyPattern.matcher(key).replaceAll("_").toUpperCase();
if (System.getenv(envKey) != null) {
return System.getenv(envKey);
}