forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit external configuration sources parsing in native-mode
`SmallryeConfigBuilder` tries to access properties files from various sources, despite them not being available at run-time nor supported in native-mode, see quarkusio#41994 This patch also avoids getting a `MissingRegistrationError` when using `-H:+ThrowMissingRegistrationErrors` or `--exact-reachability-metadata`. Related to quarkusio#41994 and quarkusio#41995
- Loading branch information
Showing
5 changed files
with
140 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...me/src/main/java/io/quarkus/runtime/configuration/FileSystemOnlySourcesConfigBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkus.runtime.configuration; | ||
|
||
import static io.smallrye.config.PropertiesConfigSourceLoader.inFileSystem; | ||
|
||
import java.nio.file.Paths; | ||
|
||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
|
||
public class FileSystemOnlySourcesConfigBuilder implements ConfigBuilder { | ||
@Override | ||
public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) { | ||
return builder.setAddDefaultSources(false).addSystemSources().withSources( | ||
inFileSystem(Paths.get(System.getProperty("user.dir"), "config", "application.properties").toUri().toString(), | ||
260, builder.getClassLoader())); | ||
} | ||
|
||
@Override | ||
public int priority() { | ||
return Integer.MAX_VALUE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ig-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/NativeYamlConfigBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.quarkus.config.yaml.runtime; | ||
|
||
import io.quarkus.runtime.configuration.ConfigBuilder; | ||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
import io.smallrye.config.source.yaml.YamlConfigSourceLoader; | ||
|
||
public class NativeYamlConfigBuilder implements ConfigBuilder { | ||
@Override | ||
public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) { | ||
return builder.withSources(new YamlConfigSourceLoader.InFileSystem()); | ||
} | ||
} |