@mimik/init 3.7.3 → 3.7.5
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/index.js +2 -2
- package/lib/logs.js +11 -5
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -105,7 +105,7 @@ module.exports = (app, rootDir, config, validates, cluster, options) => {
|
|
|
105
105
|
}
|
|
106
106
|
if (swaggerFilename[0] !== '/') swaggerFilename = path.join(rootDir, swaggerFilename);
|
|
107
107
|
logger.debug('location of the swagger file', { swaggerFilename }, correlationIdStart);
|
|
108
|
-
return swagger.getAPIFile(swaggerFilename, correlationIdStart)
|
|
108
|
+
return swagger.getAPIFile(swaggerFilename, correlationIdStart, options)
|
|
109
109
|
.then((swaggerJson) => swaggerTools.initializeMiddleware(swaggerJson, (middleware) => {
|
|
110
110
|
serverSettings.basePath = swaggerJson.basePath;
|
|
111
111
|
app.use(startHrTimeSet());
|
|
@@ -136,7 +136,7 @@ module.exports = (app, rootDir, config, validates, cluster, options) => {
|
|
|
136
136
|
}
|
|
137
137
|
else logger.warn('registration disabled: cluster will not work', correlationIdStart);
|
|
138
138
|
if (extractName) {
|
|
139
|
-
app.use(extractLogs(config, extractName));
|
|
139
|
+
app.use(extractLogs(config, extractName, options));
|
|
140
140
|
}
|
|
141
141
|
app.use(middleware.swaggerRouter({
|
|
142
142
|
useStubs: config.nodeEnvironment === LOCAL,
|
package/lib/logs.js
CHANGED
|
@@ -9,7 +9,7 @@ const { getCorrelationId } = require('@mimik/request-helper');
|
|
|
9
9
|
const correlationId = getCorrelationId('log-extraction');
|
|
10
10
|
const NOTIFICATION = '/notifications';
|
|
11
11
|
|
|
12
|
-
const extractLogs = (config, extractName) => (req, res, next) => {
|
|
12
|
+
const extractLogs = (config, extractName, options) => (req, res, next) => {
|
|
13
13
|
const { rpAuth } = oauthHelper(config);
|
|
14
14
|
let url = `${config.dependencies.mLG.url}${NOTIFICATION}`;
|
|
15
15
|
const params = new urlLib.URLSearchParams();
|
|
@@ -25,18 +25,24 @@ const extractLogs = (config, extractName) => (req, res, next) => {
|
|
|
25
25
|
}
|
|
26
26
|
else if (config.serverSettings.ip.public) xForwardedFor = config.serverSettings.ip.public;
|
|
27
27
|
logger.silly('extracting data', { extractName, url }, correlationId);
|
|
28
|
-
|
|
28
|
+
const opts = {
|
|
29
29
|
method: 'POST',
|
|
30
30
|
headers: {
|
|
31
31
|
'x-forwarded-for': xForwardedFor,
|
|
32
32
|
'x-correlation-id': correlationId,
|
|
33
33
|
},
|
|
34
34
|
url,
|
|
35
|
-
|
|
35
|
+
data: {
|
|
36
36
|
Message: req.body[extractName],
|
|
37
37
|
},
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (options && options.metrics) {
|
|
41
|
+
opts.metrics = options.metrics;
|
|
42
|
+
opts.metrics.url = url;
|
|
43
|
+
}
|
|
44
|
+
rpAuth('mLG', opts)
|
|
45
|
+
.catch((err) => getRichError('System', 'could not send extracted data', { url, extractName }, err, 'warn', correlationId));
|
|
40
46
|
delete req.body[extractName];
|
|
41
47
|
}
|
|
42
48
|
next();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mimik/init",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.5",
|
|
4
4
|
"description": "Init process for micro-service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@mimik/address-helper": "^1.6.6",
|
|
33
33
|
"@mimik/healthcheck": "^1.5.10",
|
|
34
34
|
"@mimik/oauth-helper": "^2.0.2",
|
|
35
|
-
"@mimik/public-helper": "^1.6.
|
|
35
|
+
"@mimik/public-helper": "^1.6.2",
|
|
36
36
|
"@mimik/request-helper": "^1.7.8",
|
|
37
37
|
"@mimik/response-helper": "^2.6.3",
|
|
38
38
|
"@mimik/sumologic-winston-logger": "^1.6.14",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@mimik/eslint-plugin-dependencies": "^2.4.5",
|
|
47
47
|
"@mimik/eslint-plugin-document-env": "^1.0.5",
|
|
48
|
-
"eslint": "8.
|
|
48
|
+
"eslint": "8.31.0",
|
|
49
49
|
"eslint-config-airbnb": "19.0.4",
|
|
50
50
|
"eslint-plugin-import": "2.26.0",
|
|
51
51
|
"eslint-plugin-jsx-a11y": "6.6.1",
|
|
52
52
|
"eslint-plugin-react": "7.31.11",
|
|
53
53
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
54
|
-
"husky": "8.0.
|
|
54
|
+
"husky": "8.0.3",
|
|
55
55
|
"jsdoc-to-markdown": "8.0.0"
|
|
56
56
|
}
|
|
57
57
|
}
|