Skip to content

Commit

Permalink
Merge pull request #15181 from radcortez/config
Browse files Browse the repository at this point in the history
Add Config interceptors to QuarkusConfigFactory
  • Loading branch information
gsmet authored Feb 19, 2021
2 parents 0b6efb6 + 87205d3 commit b042fca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ public SmallRyeConfig getConfigFor(final SmallRyeConfigProviderResolver configPr
//the HTTP port or logging info
return configProviderResolver.getBuilder().forClassLoader(classLoader)
.addDefaultSources()
.addDefaultInterceptors()
.addDiscoveredSources()
.addDiscoveredConverters()
.addDiscoveredInterceptors()
.withProfile(ProfileManager.getActiveProfile())
.build();
}
return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class TestHTTPConfigSourceProvider implements ConfigSourceProvider {
Map<String, String> map = new HashMap<>();
map.put(TEST_URL_KEY, sanitizeURL(TEST_URL_VALUE));
map.put(TEST_URL_SSL_KEY, sanitizeURL(TEST_URL_SSL_VALUE));
map.put("%dev." + TEST_URL_KEY, sanitizeURL(
"http://${quarkus.http.host:localhost}:${quarkus.http.test-port:8080}${quarkus.servlet.context-path:}"));
entries = Collections.unmodifiableMap(map);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ public class TestHTTPResourceManager {
public static String getUri() {
try {
Config config = ConfigProvider.getConfig();
String value = config.getValue("test.url", String.class);
if (value.equals(TestHTTPConfigSourceProvider.TEST_URL_VALUE)) {
//massive hack for dev mode tests, dev mode has not started yet
//so we don't have any way to load this correctly from config
return "http://" + config.getOptionalValue("quarkus.http.host", String.class).orElse("localhost") + ":"
+ config.getOptionalValue("quarkus.http.port", String.class).orElse("8080");
}
return value;
return config.getValue("test.url", String.class);
} catch (IllegalStateException e) {
//massive hack for dev mode tests, dev mode has not started yet
//so we don't have any way to load this correctly from config
Expand Down

0 comments on commit b042fca

Please sign in to comment.