- public static void loadConfig(Path dir, Map<String, String> config) {
- try {
-// System.out.println("Load from " + dir);
- Path jvmArgsPath = dir.resolve(JVM_ARGS);
- if (!Files.exists(jvmArgsPath)) {
- // load from parent directory
- loadConfig(dir.getParent(), config);
- }
-
- if (Files.exists(dir))
- for (Path p : Files.newDirectoryStream(dir, "*.ini")) {
- Properties props = new Properties();
- try (InputStream in = Files.newInputStream(p)) {
- props.load(in);
- }
- for (Object key : props.keySet()) {
- config.put(key.toString(), props.getProperty(key.toString()));
- }
- }
- } catch (IOException e) {
- throw new UncheckedIOException("Cannot load configuration from " + dir, e);
- }
- }
-