Skip to content

Commit

Permalink
Merge pull request #43311 from geoand/rest-client-proxy
Browse files Browse the repository at this point in the history
Fix a few issues with the local proxy for REST Client feature
  • Loading branch information
geoand authored Sep 16, 2024
2 parents c8979e7 + f2f4a2f commit e47b8ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void determineRequiredProxies(RestClientsBuildTimeConfig restClientsBuild
for (var configEntry : configs.entrySet()) {
if (!configEntry.getValue().enableLocalProxy()) {
log.trace("Ignoring config key: '" + configEntry.getKey() + "' because enableLocalProxy is false");
break;
continue;
}

String configKey = configEntry.getKey();
Expand All @@ -91,7 +91,7 @@ public void determineRequiredProxies(RestClientsBuildTimeConfig restClientsBuild

if (baseUri.isEmpty()) {
log.debug("Unable to determine uri or url for config key '" + configKey + "'");
break;
continue;
}
producer.produce(new RestClientHttpProxyBuildItem(matchingBI.getClassInfo().name().toString(), baseUri.get(),
configEntry.getValue().localProxyProvider()));
Expand All @@ -101,14 +101,14 @@ public void determineRequiredProxies(RestClientsBuildTimeConfig restClientsBuild
if (classInfo == null) {
log.debug(
"Key '" + configKey + "' could not be matched to either a class name or a REST Client's configKey");
break;
continue;
}
Optional<String> baseUri = oneOf(
Optional.ofNullable(restClientValues.get("uri")),
Optional.ofNullable(restClientValues.get("url")));
if (baseUri.isEmpty()) {
log.debug("Unable to determine uri or url for config key '" + configKey + "'");
break;
continue;
}
producer.produce(new RestClientHttpProxyBuildItem(classInfo.name().toString(), baseUri.get(),
configEntry.getValue().localProxyProvider()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ public <T> T build(Class<T> aClass) throws IllegalStateException, RestClientDefi
RestClientsConfig restClients = config.getConfigMapping(RestClientsConfig.class);

// support overriding the URI from the override-uri property
Optional<String> maybeOverrideUri = restClients.getClient(aClass).overrideUri();
var overrideUrlKeyName = String.format("quarkus.rest-client.\"%s\".override-uri", aClass.getName());
Optional<String> maybeOverrideUri = config.getOptionalValue(overrideUrlKeyName, String.class);
if (maybeOverrideUri.isPresent()) {
uri = URI.create(maybeOverrideUri.get());
}
Expand Down

0 comments on commit e47b8ed

Please sign in to comment.