alibaba / alibaba/DataX

配置里的环境变量不支持 带 . ,例如 ${db.name}

Open
#1,751 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17.4k
Forks
5.7k
PR merge metrics
No merged PRs in 30d

Description

private static final Pattern VARIABLE_PATTERN = Pattern
.compile("(\\$)\\{?(\\w+)\\}?");

public static String replaceVariable(final String param) {
Map mapping = new HashMap();

Matcher matcher = VARIABLE_PATTERN.matcher(param);
while (matcher.find()) {
String variable = matcher.group(2);
String value = System.getProperty(variable);
if (StringUtils.isBlank(value)) {
value = matcher.group();
}
mapping.put(matcher.group(), value);
}

String retString = param;
for (final String key : mapping.keySet()) {
retString = retString.replace(key, mapping.get(key));
}

return retString;
}

应该是这个正则表达式有问题。

${db.name} 会被匹配到 ${db

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the VARIABLE_PATTERN and replaceVariable method shown in the issue. Verify how ${db.name} is matched and confirm that the completed change resolves the full dotted variable while preserving existing variable replacement behavior; no test or file path is named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.