kezhenxu94 commented on a change in pull request #4514: Add selector property
in application.yml
URL: https://github.com/apache/skywalking/pull/4514#discussion_r392639648
##########
File path:
oap-server/server-bootstrap/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -105,6 +107,19 @@ private void
overrideConfigBySystemEnv(ApplicationConfiguration configuration) {
}
}
+ private void selectConfig(final Map<String, Object> configuration) {
+ if (configuration.size() <= 1) {
+ return;
+ }
+ if (configuration.containsKey("selector")) {
+ final String selector = (String) configuration.get("selector");
+ final String resolvedSelector =
PropertyPlaceholderHelper.INSTANCE.replacePlaceholders(
+ selector, System.getProperties()
+ );
+ configuration.entrySet().removeIf(e ->
!resolvedSelector.equals(e.getKey()));
Review comment:
> I think you need to add a check and error for selected provider not found,
when you give a value to selector, but no suitable provider definition here.
Yes, thanks for pointing out, just found that and fixed
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services