Skip to content

Commit

Permalink
support a way to ignore check some key in parameters. (#7371)
Browse files Browse the repository at this point in the history
  • Loading branch information
horizonzy committed Mar 25, 2021
1 parent f49b966 commit 455852e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ public interface Constants {
String ZOOKEEPER_PROTOCOL = "zookeeper";

String REGISTER_KEY = "register";

String IGNORE_CHECK_KEYS = "ignoreCheckKeys";
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -102,6 +103,7 @@
import static org.apache.dubbo.config.Constants.CONTEXTPATH_KEY;
import static org.apache.dubbo.config.Constants.DUBBO_IP_TO_REGISTRY;
import static org.apache.dubbo.config.Constants.ENVIRONMENT;
import static org.apache.dubbo.config.Constants.IGNORE_CHECK_KEYS;
import static org.apache.dubbo.config.Constants.LAYER_KEY;
import static org.apache.dubbo.config.Constants.NAME;
import static org.apache.dubbo.config.Constants.ORGANIZATION;
Expand Down Expand Up @@ -624,8 +626,14 @@ public static void checkParameterName(Map<String, String> parameters) {
if (CollectionUtils.isEmptyMap(parameters)) {
return;
}
List<String> ignoreCheckKeys = new ArrayList<>();
ignoreCheckKeys.add(BACKUP_KEY);
String ignoreCheckKeysStr = parameters.get(IGNORE_CHECK_KEYS);
if (!StringUtils.isBlank(ignoreCheckKeysStr)) {
ignoreCheckKeys.addAll(Arrays.asList(ignoreCheckKeysStr.split(",")));
}
for (Map.Entry<String, String> entry : parameters.entrySet()) {
if (!entry.getKey().equals(BACKUP_KEY)) {
if (!ignoreCheckKeys.contains(entry.getKey())) {
checkNameHasSymbol(entry.getKey(), entry.getValue());
}
}
Expand Down

0 comments on commit 455852e

Please sign in to comment.