wu-sheng commented on a change in pull request #4514: Add selector property in application.yml URL: https://github.com/apache/skywalking/pull/4514#discussion_r392670096
########## File path: oap-server/server-bootstrap/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java ########## @@ -105,6 +112,48 @@ private void overrideConfigBySystemEnv(ApplicationConfiguration configuration) { } } + private void selectConfig(final Map<String, Map<String, Object>> moduleConfiguration) { + final Set<String> modulesWithoutProvider = new HashSet<>(); + for (final Map.Entry<String, Map<String, Object>> entry : moduleConfiguration.entrySet()) { + final String moduleName = entry.getKey(); + final Map<String, Object> providerConfig = entry.getValue(); + if (!providerConfig.containsKey(SELECTOR)) { + continue; + } + final String selector = (String) providerConfig.get(SELECTOR); + final String resolvedSelector = PropertyPlaceholderHelper.INSTANCE.replacePlaceholders( + selector, System.getProperties() + ); + providerConfig.entrySet().removeIf(e -> !resolvedSelector.equals(e.getKey())); + + if (!providerConfig.isEmpty()) { + continue; + } + + if (!DISABLE_SELECTOR.equals(resolvedSelector)) { + throw new RuntimeException( Review comment: This should be `ProviderNotFoundException` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services