@vulkano/core 1.7.0 → 1.8.0
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/bootstrap/express.js +1 -0
- package/bootstrap/server.js +33 -2
- package/package.json +2 -1
package/bootstrap/express.js
CHANGED
package/bootstrap/server.js
CHANGED
|
@@ -15,6 +15,7 @@ const helmet = require('helmet');
|
|
|
15
15
|
const timeout = require('connect-timeout');
|
|
16
16
|
const useragent = require('express-useragent');
|
|
17
17
|
const cookieParser = require('cookie-parser');
|
|
18
|
+
const expressSession = require('express-session');
|
|
18
19
|
const { createClient: socketRedis } = require('redis');
|
|
19
20
|
const socketMongoose = require('mongoose');
|
|
20
21
|
const { createAdapter: socketRedisAdapter } = require('@socket.io/redis-adapter');
|
|
@@ -86,12 +87,22 @@ module.exports = function loadServer() {
|
|
|
86
87
|
// ---------------
|
|
87
88
|
// COOKIES - File: app/config/express/cookies.js
|
|
88
89
|
// ---------------
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
const {
|
|
91
|
+
enabled: cookiesEnabled
|
|
92
|
+
} = expressConfig.cookies || {};
|
|
93
|
+
|
|
94
|
+
let cookiesSecretKey = null;
|
|
95
|
+
|
|
96
|
+
if (cookiesEnabled) {
|
|
97
|
+
|
|
98
|
+
cookiesSecretKey = COOKIES_SECRET_KEY || expressConfig.cookies.key || expressConfig.cookies.secret || '';
|
|
99
|
+
|
|
91
100
|
if (!cookiesSecretKey) {
|
|
92
101
|
console.log(' \x1b[33mWARNING\x1b[0m: Set the secret key in the config/express/cookie.js file or COOKIES_SECRET_KEY in the .env file.');
|
|
93
102
|
}
|
|
103
|
+
|
|
94
104
|
vulkano.use(cookieParser(cookiesSecretKey));
|
|
105
|
+
|
|
95
106
|
}
|
|
96
107
|
|
|
97
108
|
// ---------------
|
|
@@ -232,6 +243,26 @@ module.exports = function loadServer() {
|
|
|
232
243
|
});
|
|
233
244
|
}
|
|
234
245
|
|
|
246
|
+
// ---------------
|
|
247
|
+
// Express Session - File: app/config/express/session.js
|
|
248
|
+
// ---------------
|
|
249
|
+
const {
|
|
250
|
+
enabled: sessionEnabled
|
|
251
|
+
} = expressConfig.session || {};
|
|
252
|
+
|
|
253
|
+
if (sessionEnabled) {
|
|
254
|
+
|
|
255
|
+
if (!cookiesEnabled) {
|
|
256
|
+
console.log(' \x1b[41mERROR\x1b[0m: Can not load the Express Session because the Cookies aren\'t enabled');
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
delete expressConfig.session.enabled;
|
|
261
|
+
|
|
262
|
+
vulkano.use(expressSession({ ...expressConfig.session, secret: cookiesSecretKey }));
|
|
263
|
+
|
|
264
|
+
}
|
|
265
|
+
|
|
235
266
|
// ---------------
|
|
236
267
|
// Content Security Policy - File: app/config/express/csp.js
|
|
237
268
|
// ---------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulkano/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A MVC framework using Express 4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vulkano Team",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"dotenv": "^16.4.5",
|
|
42
42
|
"express": "^4.19.2",
|
|
43
43
|
"express-jwt": "^8.4.1",
|
|
44
|
+
"express-session": "^1.18.0",
|
|
44
45
|
"express-useragent": "^1.0.15",
|
|
45
46
|
"frameguard": "^4.0.0",
|
|
46
47
|
"fs": "^0.0.1-security",
|