Skip to content

Commit

Permalink
- issue #460
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Mar 8, 2024
1 parent cbb078c commit d9babf9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
CACHE_FILE_APIM: api-manager_7_7_20240228.cache.tar
CACHE_FILE_CASSANDRA: cassandra_4_0_11.cache.tar
FED_FILE: swagger-promote-7.7-20240228.fed
LOG_LEVEL: debug
LOG_LEVEL: info

jobs:
build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,16 @@ public void configureBasePath(String backendBasePath, API api) throws AppExcepti
try {
if (openApiNode.has(SERVERS)) {
ArrayNode servers = (ArrayNode) openApiNode.get(SERVERS);
if (!servers.isEmpty()) {
// Remove remaining server nodes as currently not handling multiple URLs
for (int i = 1; i < servers.size(); i++) {
servers.remove(i);
}
if (backendBasePath != null && !backendBasePath.contains("${env")) { // issue #332
JsonNode server = servers.get(0);
JsonNode urlJsonNode = server.get("url");
if (urlJsonNode != null) {
String serverUrl = urlJsonNode.asText();
if (CoreParameters.getInstance().isOverrideSpecBasePath()) {
overrideServerSection(backendBasePath); // override openapi url with backendBaseapath
} else if (!serverUrl.startsWith("http")) { // If url does not have hostname, add hostname from backendBasepath
LOG.info("servers.url does not contain host name hence updating host value from backendBasepath : {}", backendBasePath);
updateServerSection(backendBasePath, serverUrl);
}
if (backendBasePath != null && !backendBasePath.contains("${env")) { // issue #332
JsonNode server = servers.get(0);
JsonNode urlJsonNode = server.get("url");
if (urlJsonNode != null) {
String serverUrl = urlJsonNode.asText();
if (CoreParameters.getInstance().isOverrideSpecBasePath()) {
overrideServerSection(backendBasePath); // override openapi url with backendBaseapath
} else if (!serverUrl.startsWith("http")) { // If url does not have hostname, add hostname from backendBasepath
LOG.info("servers.url does not contain host name hence updating host value from backendBasepath : {}", backendBasePath);
updateServerSection(backendBasePath, serverUrl);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ private void addAPISpecification(API apiConfig) throws IOException {
} else {
throw new AppException("No API Specification configured", ErrorCode.NO_API_DEFINITION_CONFIGURED);
}
apiSpecification.configureBasePath(((DesiredAPI) apiConfig).getBackendBasepath(), apiConfig);
apiConfig.setApiDefinition(apiSpecification);
}

Expand Down

0 comments on commit d9babf9

Please sign in to comment.