Merge pull request #1 from ilaotan/ilaotan-patch-1

feat: for doceker  read values form env
This commit is contained in:
不想当厨子的老谭 2023-05-18 17:36:15 +08:00 committed by GitHub
commit e0b2797a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,9 +58,14 @@ public class StrUtil {
Matcher matcher = VARIABLE_PATTERN.matcher(param); Matcher matcher = VARIABLE_PATTERN.matcher(param);
while (matcher.find()) { while (matcher.find()) {
String variable = matcher.group(2); String variable = matcher.group(2);
String value = System.getProperty(variable); String value = matcher.group();
if (StringUtils.isBlank(value)) { String valueFromEnv = System.getenv(variable);
value = matcher.group(); String valueFromProp = System.getProperty(variable);
if (StringUtils.isNotBlank(valueFromEnv)) {
value = valueFromEnv;
}
if (StringUtils.isNotBlank(valueFromProp)) {
value = valueFromProp;
} }
mapping.put(matcher.group(), value); mapping.put(matcher.group(), value);
} }