@sap-ux/backend-proxy-middleware 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/proxy.js +6 -3
- package/dist/base/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/base/proxy.js
CHANGED
|
@@ -275,8 +275,7 @@ function generateProxyMiddlewareOptions(backend, options = {}, logger = new logg
|
|
|
275
275
|
proxyOptions.changeOrigin = true;
|
|
276
276
|
proxyOptions.logProvider = () => logger;
|
|
277
277
|
// always set the target to the url provided in yaml
|
|
278
|
-
|
|
279
|
-
proxyOptions.target = localBackend.url;
|
|
278
|
+
proxyOptions.target = backend.url;
|
|
280
279
|
// overwrite url if running in AppStudio
|
|
281
280
|
if (btp_utils_1.isAppStudio()) {
|
|
282
281
|
const destBackend = backend;
|
|
@@ -287,6 +286,7 @@ function generateProxyMiddlewareOptions(backend, options = {}, logger = new logg
|
|
|
287
286
|
}
|
|
288
287
|
}
|
|
289
288
|
else {
|
|
289
|
+
const localBackend = backend;
|
|
290
290
|
// check if system credentials are stored in the store
|
|
291
291
|
const systemStore = yield store_1.getService({ logger, entityName: 'system' });
|
|
292
292
|
const system = yield systemStore.read(new store_1.BackendSystemKey({ url: localBackend.url, client: localBackend.client }));
|
|
@@ -312,11 +312,14 @@ function generateProxyMiddlewareOptions(backend, options = {}, logger = new logg
|
|
|
312
312
|
proxyOptions.headers['apikey'] = apiHubKey;
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
+
if (!proxyOptions.target) {
|
|
316
|
+
throw new Error(`Unable to determine target from configuration:\n${JSON.stringify(backend, null, 2)}`);
|
|
317
|
+
}
|
|
315
318
|
backend.proxy = config_1.getCorporateProxyServer(backend.proxy);
|
|
316
319
|
if (backend.proxy && !config_1.isHostExcludedFromProxy(proxyOptions.target)) {
|
|
317
320
|
proxyOptions.agent = new https_proxy_agent_1.HttpsProxyAgent(backend.proxy);
|
|
318
321
|
}
|
|
319
|
-
logger.info(`Backend proxy created for ${proxyOptions.target
|
|
322
|
+
logger.info(`Backend proxy created for ${proxyOptions.target} ${backend.path ? backend.path : ''}`);
|
|
320
323
|
return proxyOptions;
|
|
321
324
|
});
|
|
322
325
|
}
|
package/dist/base/types.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ export interface BaseBackendConfig {
|
|
|
31
31
|
bsp?: string;
|
|
32
32
|
}
|
|
33
33
|
export interface DestinationBackendConfig extends BaseBackendConfig {
|
|
34
|
+
/**
|
|
35
|
+
* Optional URL pointing to the backend system
|
|
36
|
+
*/
|
|
37
|
+
url?: string;
|
|
34
38
|
/**
|
|
35
39
|
* Required if the backend system is available as destination in SAP Business Application Studio.
|
|
36
40
|
*/
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Abackend-proxy-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.6.
|
|
12
|
+
"version": "0.6.8",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|