in microprofile-extensions/microprofile-extensions-config/docker-configsource/src/main/java/org/apache/geronimo/microprofile/extensions/config/docker/DockerConfigConfigSource.java [55:80]
private static Map<String, String> reload(final String base, final String... prefixes) {
final Path from = Paths.get(base);
if (!Files.exists(from)) {
return emptyMap();
}
final Predicate<Path> matches =
// if no prefix ensure it is not default unix folders or not supported config files
prefixes.length == 0
? path -> !Files.isDirectory(path) && Stream
.of(".xml", ".properties", ".yml", ".yaml", ".so", ".json", ".old", ".img", "vmlinuz",
"core")
.noneMatch(ext -> path.getFileName().toString().endsWith(ext))
: path -> Stream
.of(prefixes)
.anyMatch(prefix -> path.getFileName().toString().startsWith(prefix));
try {
return Files
.list(from)
.filter(matches)
.map(path -> new AbstractMap.SimpleEntry<>(path.getFileName().toString(), read(path)))
.filter(e -> e.getValue() != null)
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
} catch (final IOException e) {
throw new IllegalStateException(e);
}
}