soajs.controller 4.2.35 → 4.2.36
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/mw/gotoService/index.js +1 -0
- package/mw/mt/index.js +4 -1
- package/mw/url/index.js +16 -4
- package/package.json +1 -1
- package/server/controller.js +3 -1
package/mw/gotoService/index.js
CHANGED
|
@@ -82,6 +82,7 @@ module.exports = (configuration) => {
|
|
|
82
82
|
req.soajs.registry.services[service_n]) {
|
|
83
83
|
req.soajs.log.debug(req.soajs.registry.services[service_n]);
|
|
84
84
|
}
|
|
85
|
+
req.soajs.log.warn(JSON.stringify({ "url": req.url, "headers": req.headers }));
|
|
85
86
|
return req.soajs.controllerResponse(core.error.getError(130));
|
|
86
87
|
}
|
|
87
88
|
|
package/mw/mt/index.js
CHANGED
|
@@ -40,7 +40,10 @@ module.exports = (configuration) => {
|
|
|
40
40
|
|
|
41
41
|
let serviceParam = {};
|
|
42
42
|
if (!proxy) {
|
|
43
|
-
let serviceInfo =
|
|
43
|
+
let serviceInfo = null;
|
|
44
|
+
if (req.soajs.controller.serviceParams.registry.versions) {
|
|
45
|
+
serviceInfo = req.soajs.controller.serviceParams.registry.versions[req.soajs.controller.serviceParams.version];
|
|
46
|
+
}
|
|
44
47
|
if (!serviceInfo) {
|
|
45
48
|
req.soajs.log.error("Problem accessing service [" + req.soajs.controller.serviceParams.name + "], API [" + req.soajs.controller.serviceParams.path + "] & version [" + req.soajs.controller.serviceParams.version + "]");
|
|
46
49
|
return next(133);
|
package/mw/url/index.js
CHANGED
|
@@ -20,21 +20,21 @@ let libParseURL = require('../../lib/parseURL');
|
|
|
20
20
|
*/
|
|
21
21
|
module.exports = (configuration) => {
|
|
22
22
|
let core = configuration.core;
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
return (req, res, next) => {
|
|
25
25
|
if (!req.soajs) {
|
|
26
26
|
throw new TypeError('soajs mw is not started');
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
if (!req.soajs.controller) {
|
|
30
30
|
req.soajs.controller = {};
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
let parsedUrl = url.parse(req.url, true);
|
|
34
34
|
if (!req.query && parsedUrl.query) {
|
|
35
35
|
req.query = parsedUrl.query;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
if (!req.query) {
|
|
39
39
|
req.query = {};
|
|
40
40
|
}
|
|
@@ -42,6 +42,18 @@ module.exports = (configuration) => {
|
|
|
42
42
|
if (!req.soajs.controller.serviceParams.service_n || req.soajs.controller.serviceParams.service_n === '') {
|
|
43
43
|
return req.soajs.controllerResponse(core.error.getError(136));
|
|
44
44
|
}
|
|
45
|
+
if (
|
|
46
|
+
req.soajs.controller.serviceParams.service_n !== "soajs" &&
|
|
47
|
+
(
|
|
48
|
+
!req.soajs.registry ||
|
|
49
|
+
!req.soajs.registry.services ||
|
|
50
|
+
!req.soajs.registry.services[req.soajs.controller.serviceParams.service_n]
|
|
51
|
+
)) {
|
|
52
|
+
req.soajs.log.fatal("Service [" + req.soajs.controller.serviceParams.service_n + "] URL [" + req.url + "] couldn't be matched to a service or the service entry in registry is missing [port || hosts]");
|
|
53
|
+
req.soajs.log.warn(JSON.stringify({ "url": req.url, "headers": req.headers }));
|
|
54
|
+
return req.soajs.controllerResponse(core.error.getError(130));
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
let key = req.headers.key || req.query.key;
|
|
46
58
|
if (!req.headers.key) {
|
|
47
59
|
req.headers.key = key;
|
package/package.json
CHANGED
package/server/controller.js
CHANGED
|
@@ -94,6 +94,8 @@ Controller.prototype.init = function (callback) {
|
|
|
94
94
|
app.use(ip2ban_mw());
|
|
95
95
|
app.use(maintenanceMode_mw()); //NOTE: this is for global maintenance mode
|
|
96
96
|
|
|
97
|
+
app.use(url_mw({ "core": core }));
|
|
98
|
+
|
|
97
99
|
log.info("Loading Provision ...");
|
|
98
100
|
let dbConfig = registry.coreDB.provision;
|
|
99
101
|
if (registry.coreDB.oauth) {
|
|
@@ -135,7 +137,7 @@ Controller.prototype.init = function (callback) {
|
|
|
135
137
|
|
|
136
138
|
// app.use(enhancer_mw());
|
|
137
139
|
|
|
138
|
-
app.use(url_mw({ "core": core }));
|
|
140
|
+
// app.use(url_mw({ "core": core }));
|
|
139
141
|
|
|
140
142
|
app.use(key_mw({ "provision": provision, "regEnvironment": regEnvironment }));
|
|
141
143
|
|