mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
feat: move EXTERNAL_REQUEST_TIMEOUT to config file
This commit is contained in:
committed by
Rainer Killinger
parent
8eab6b8531
commit
5d6d4b53f0
@@ -50,6 +50,7 @@ const config: Partial<SCConfigFile> = {
|
|||||||
},
|
},
|
||||||
backend: {
|
backend: {
|
||||||
SCVersion: '1.0.0',
|
SCVersion: '1.0.0',
|
||||||
|
externalRequestTimeout: 5000,
|
||||||
hiddenTypes: [
|
hiddenTypes: [
|
||||||
SCThingType.DateSeries,
|
SCThingType.DateSeries,
|
||||||
SCThingType.Diff,
|
SCThingType.Diff,
|
||||||
|
|||||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -219,13 +219,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@openstapps/core": {
|
"@openstapps/core": {
|
||||||
"version": "0.25.0",
|
"version": "0.26.0",
|
||||||
"resolved": "https://registry.npmjs.org/@openstapps/core/-/core-0.25.0.tgz",
|
"resolved": "https://registry.npmjs.org/@openstapps/core/-/core-0.26.0.tgz",
|
||||||
"integrity": "sha512-Xh+ub2Drns+fORaYt0K/RQ6N1MpYP3llpxEq3SBh48qPCwVBYJ4OVYaJEtSxN/Soxyk2l/7DioTBNvnYiya4MQ==",
|
"integrity": "sha512-r8mAplHPY7gS8EsuQv8NHfqR4TZ2ptEouMPjtvx2L7I0g0+YgnYO9ZP0QQGHmEeLYoJ01XdDkxOAasXsa2KGBw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/geojson": "1.0.6",
|
"@types/geojson": "1.0.6",
|
||||||
"@types/json-patch": "0.0.30",
|
"@types/json-patch": "0.0.30",
|
||||||
"@types/node": "10.14.13",
|
"@types/node": "10.14.14",
|
||||||
"fast-clone": "1.5.13",
|
"fast-clone": "1.5.13",
|
||||||
"http-status-codes": "1.3.2",
|
"http-status-codes": "1.3.2",
|
||||||
"json-patch": "0.7.0",
|
"json-patch": "0.7.0",
|
||||||
@@ -234,9 +234,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "10.14.13",
|
"version": "10.14.14",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.14.tgz",
|
||||||
"integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ=="
|
"integrity": "sha512-xXD08vZsvpv4xptQXj1+ky22f7ZoKu5ZNI/4l+/BXG3X+XaeZsmaFbbTKuhSE3NjjvRuZFxFf9sQBMXIcZNFMQ=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
"tslint": "tslint -p tsconfig.json -c tslint.json 'src/**/*.ts'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@openstapps/core": "0.25.0",
|
"@openstapps/core": "0.26.0",
|
||||||
"@openstapps/core-tools": "0.8.0",
|
"@openstapps/core-tools": "0.8.0",
|
||||||
"@openstapps/logger": "0.4.0",
|
"@openstapps/logger": "0.4.0",
|
||||||
"@types/node": "10.14.12",
|
"@types/node": "10.14.12",
|
||||||
|
|||||||
@@ -21,12 +21,7 @@ import {
|
|||||||
} from '@openstapps/core';
|
} from '@openstapps/core';
|
||||||
import {Request} from 'express';
|
import {Request} from 'express';
|
||||||
import * as got from 'got';
|
import * as got from 'got';
|
||||||
import {isTestEnvironment, validator} from '../common';
|
import {configFile, isTestEnvironment, validator} from '../common';
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of milliseconds after which external request will fail
|
|
||||||
*/
|
|
||||||
export const EXTERNAL_REQUEST_TIMEOUT = 5000;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic route function used to proxy actual requests to plugins
|
* Generic route function used to proxy actual requests to plugins
|
||||||
@@ -49,7 +44,7 @@ export async function virtualPluginRoute(req: Request, plugin: SCPluginMetaData)
|
|||||||
baseUrl: plugin.address,
|
baseUrl: plugin.address,
|
||||||
body: req.body,
|
body: req.body,
|
||||||
json: true,
|
json: true,
|
||||||
timeout: EXTERNAL_REQUEST_TIMEOUT,
|
timeout: configFile.backend.externalRequestTimeout,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
responseBody = pluginResponse.body;
|
responseBody = pluginResponse.body;
|
||||||
|
|||||||
Reference in New Issue
Block a user