Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 8658eca

Browse files
author
Chris Wiechmann
committed
Changed parseAPIManager which relies on ANM-Config as well
1 parent cb2ec3e commit 8658eca

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ async function parseAPIManagerConfig(pluginConfig, options) {
9797
}
9898
pluginConfig.apimanager.configs = {};
9999
if(!pluginConfig.apimanager.url) {
100-
// If no API-Manager URL is given, use the Admin-Node-Manager URL
101-
const managerURL = new URL(pluginConfig.apigateway.url);
100+
// If no API-Manager URL is given, use the default Admin-Node-Manager URL
101+
const managerURL = new URL(pluginConfig.apigateway.configs.default.url);
102102
managerURL.port = 8075;
103103
options.logger.info(`Parameter API_MANAGER not set. Expect API-Manager on URL: ${managerURL.toString()}`);
104104
pluginConfig.apimanager.configs.default = {

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/test/testManagerANMConfigParser.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,32 @@ describe('Test API-Manager configuration variations', () => {
3434

3535
it('should succeed without giving an API-Manager', async () => {
3636
const pluginConfig = {
37-
apigateway: { url: "http://my.api-gateway.com:8090" },
37+
apigateway: { configs: { default: { url: "http://my.api-gateway.com:8090" }}, url: "http://my.api-gateway.com:8090" },
38+
apimanager: {
39+
username: "user", password: "password"
40+
}
41+
};
42+
var expectedManagers = {
43+
username: "user", password: "password",
44+
"configs": {
45+
"default": {
46+
url: "http://my.api-gateway.com:8075/",
47+
username: "user", password: "password"
48+
}
49+
}
50+
}
51+
await parseAPIManagerConfig(pluginConfig, options);
52+
expect(pluginConfig.apimanager).to.deep.equal(expectedManagers);
53+
});
54+
55+
it('should succeed without giving an API-Manager and having a region based ANM', async () => {
56+
const pluginConfig = {
57+
apigateway: {
58+
configs: {
59+
default: { url: "http://my.api-gateway.com:8090" },
60+
us: { url: "http://my.api-us-gateway.com:8090" }
61+
},
62+
url: "http://my.api-gateway.com:8090,US|http://my.api-us-gateway.com:8090" },
3863
apimanager: {
3964
username: "user", password: "password"
4065
}

0 commit comments

Comments
 (0)