@vulkano/core 1.3.0 → 1.3.1
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/server.js +27 -8
- package/package.json +1 -1
package/bootstrap/server.js
CHANGED
|
@@ -23,21 +23,29 @@ const AllControllers = require('include-all')({
|
|
|
23
23
|
optional: true
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
// Views Config
|
|
26
27
|
const viewsConfig = require('./views');
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const JWT = require('../libs/Jwt');
|
|
29
|
+
// JWT Middleware
|
|
30
|
+
const jwtMiddleware = require('../libs/Jwt');
|
|
31
31
|
|
|
32
|
+
// Express Config
|
|
32
33
|
const expressConfig = require('./express')();
|
|
33
34
|
|
|
35
|
+
// Express Responses
|
|
36
|
+
const responses = require('./responses');
|
|
37
|
+
|
|
34
38
|
module.exports = {
|
|
35
39
|
|
|
36
40
|
routes: {},
|
|
37
41
|
|
|
38
42
|
start: async function loadServerApplication(cb) {
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
// Get ENV Vars
|
|
45
|
+
const {
|
|
46
|
+
JWT_SECRET_KEY,
|
|
47
|
+
COOKIES_SECRET_KEY
|
|
48
|
+
} = process.env || {};
|
|
41
49
|
|
|
42
50
|
const vulkano = express();
|
|
43
51
|
|
|
@@ -73,7 +81,7 @@ module.exports = {
|
|
|
73
81
|
// COOKIES - File: app/config/express/cookies.js
|
|
74
82
|
// ---------------
|
|
75
83
|
if (expressConfig.cookies && expressConfig.cookies.enabled) {
|
|
76
|
-
const cookiesSecretKey =
|
|
84
|
+
const cookiesSecretKey = COOKIES_SECRET_KEY || expressConfig.cookies.key || expressConfig.cookies.secret || '';
|
|
77
85
|
if (!cookiesSecretKey) {
|
|
78
86
|
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.');
|
|
79
87
|
}
|
|
@@ -171,7 +179,7 @@ module.exports = {
|
|
|
171
179
|
// ---------------
|
|
172
180
|
if (expressConfig.jwt && expressConfig.jwt.enabled) {
|
|
173
181
|
|
|
174
|
-
const jwtSecretKey =
|
|
182
|
+
const jwtSecretKey = JWT_SECRET_KEY || expressConfig.jwt.key || expressConfig.jwt.secret || '';
|
|
175
183
|
if (!jwtSecretKey) {
|
|
176
184
|
console.log(' \x1b[41mERROR\x1b[0m: Can not get key in config/express/jwt.js file or JWT_SECRET_KEY in .env file');
|
|
177
185
|
return;
|
|
@@ -299,6 +307,14 @@ module.exports = {
|
|
|
299
307
|
}
|
|
300
308
|
});
|
|
301
309
|
|
|
310
|
+
// ---------------
|
|
311
|
+
// PUBLIC PATH - File: app/config/settings.js
|
|
312
|
+
// (if are using Vite)
|
|
313
|
+
// ---------------
|
|
314
|
+
if (!app.viteProxy) {
|
|
315
|
+
vulkano.use(express.static(PUBLIC_PATH));
|
|
316
|
+
}
|
|
317
|
+
|
|
302
318
|
// ---------------
|
|
303
319
|
// ROUTES
|
|
304
320
|
// ---------------
|
|
@@ -423,9 +439,12 @@ module.exports = {
|
|
|
423
439
|
});
|
|
424
440
|
|
|
425
441
|
// ---------------
|
|
426
|
-
// PUBLIC PATH
|
|
442
|
+
// PUBLIC PATH
|
|
443
|
+
// (if not are using Vite)
|
|
427
444
|
// ---------------
|
|
428
|
-
|
|
445
|
+
if (app.viteProxy) {
|
|
446
|
+
vulkano.use(express.static(PUBLIC_PATH));
|
|
447
|
+
}
|
|
429
448
|
|
|
430
449
|
app.vulkano = vulkano;
|
|
431
450
|
app.server = server;
|