Skip to content

Commit 4bfc25d

Browse files
authored
Allow the config library to properly determine the origin of config entries.
1 parent f87d758 commit 4bfc25d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

jooby/src/main/java/io/jooby/Environment.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private static Config resolveConfig(@Nonnull EnvironmentOptions options, Path us
362362
}
363363

364364
for (String name : names) {
365-
Config it = fileConfig(userdir, rootdirs, name);
365+
Config it = fileConfig(rootdirs, name);
366366
if (it == null) {
367367
// classpath
368368
it = classpathConfig(options.getClassLoader(), cpdirs, name);
@@ -410,15 +410,11 @@ private static Config resolveConfig(@Nonnull EnvironmentOptions options, Path us
410410
return pid;
411411
}
412412

413-
private static Config fileConfig(Path userdir, Path[] basedirs, String name) {
413+
private static Config fileConfig(Path[] basedirs, String name) {
414414
for (Path basedir : basedirs) {
415415
Path file = basedir.resolve(name);
416416
if (Files.exists(file)) {
417-
String origin = file.startsWith(userdir)
418-
? userdir.relativize(file).toString()
419-
: file.toString();
420-
return ConfigFactory.parseFile(file.toFile(),
421-
ConfigParseOptions.defaults().setOriginDescription(origin));
417+
return ConfigFactory.parseFile(file.toFile());
422418
}
423419
}
424420
return null;
@@ -430,8 +426,7 @@ private static Config classpathConfig(ClassLoader classLoader, String[] basedirs
430426
? name
431427
: Stream.concat(Stream.of(basedir.split("/")), Stream.of(name))
432428
.collect(Collectors.joining("/"));
433-
Config config = ConfigFactory.parseResources(classLoader, file,
434-
ConfigParseOptions.defaults().setOriginDescription("classpath://" + file));
429+
Config config = ConfigFactory.parseResources(classLoader, file);
435430
if (!config.isEmpty()) {
436431
return config;
437432
}

0 commit comments

Comments
 (0)