thirsd commented on code in PR #8984:
URL: https://github.com/apache/seatunnel/pull/8984#discussion_r2020086400
##########
seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigShadeUtils.java:
##########
@@ -173,29 +173,50 @@ private static Config processConfig(
String jsonString =
config.root().render(ConfigRenderOptions.concise());
ObjectNode jsonNodes = JsonUtils.parseObject(jsonString);
Map<String, Object> configMap = JsonUtils.toMap(jsonNodes);
- List<Map<String, Object>> sources =
- (ArrayList<Map<String, Object>>)
configMap.get(Constants.SOURCE);
- List<Map<String, Object>> sinks =
- (ArrayList<Map<String, Object>>) configMap.get(Constants.SINK);
- Preconditions.checkArgument(
- !sources.isEmpty(), "Miss <Source> config! Please check the
config file.");
- Preconditions.checkArgument(
- !sinks.isEmpty(), "Miss <Sink> config! Please check the config
file.");
- sources.forEach(
- source -> {
- for (String sensitiveOption : sensitiveOptions) {
- source.computeIfPresent(sensitiveOption,
processFunction);
- }
- });
- sinks.forEach(
- sink -> {
- for (String sensitiveOption : sensitiveOptions) {
- sink.computeIfPresent(sensitiveOption,
processFunction);
- }
- });
- configMap.put(Constants.SOURCE, sources);
- configMap.put(Constants.SINK, sinks);
- return ConfigFactory.parseMap(configMap);
+ if (configMap.containsKey(Constants.SOURCE)) {
Review Comment:
> As far as i know the configMap should alway contains source and sink, no
matter whether it refer to the config file. Is there any case configmap doesn't
contain source node?
use `ref config` to simplify conn info, there's no source or sink node.
like
```
# 定义 MySQL 连接配置
mysql_prod {
url = "jdbc:mysql://192.168.1.19:3306/test"
driver = "com.mysql.cj.jdbc.Driver"
connection_check_timeout_sec = 100
user = "root"
password = "111111"
fetch_size = 10000
query="select * from not_exist"
}
# 定义 Kafka 连接配置
kafka_test {
bootstrap.servers = "kafka-test:9092"
topic = "test_topic"
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]