@sassoftware/viya-serverjs 0.2.3 → 0.3.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/.env +6 -7
- package/.env.proxy +3 -3
- package/.env.server +3 -3
- package/Dockerfile +4 -4
- package/lib/config.js +62 -62
- package/lib/handlers/logon.js +39 -39
- package/lib/handlers/proxyMapUri.js +49 -49
- package/lib/handlers/setCookies.js +73 -73
- package/lib/iService.js +408 -401
- package/lib/plugins/appCookie.js +98 -98
- package/lib/plugins/setDefaultRoutes.js +247 -272
- package/lib/plugins/setupAuth.js +68 -68
- package/package.json +2 -2
- package/public/index.html +288 -297
- package/public/indexProxy.html +2 -2
- package/src/iService.js +18 -20
- package/src/plugins/setDefaultRoutes.js +0 -11
package/src/iService.js
CHANGED
|
@@ -196,7 +196,7 @@ function iService (userRouteTable, useDefault, asset, allAppEnv, serverMode, use
|
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
console.log('Plugin', process.env.PLUGIN);
|
|
200
200
|
|
|
201
201
|
if (process.env.PLUGIN === 'hapi-swagger' && serverMode ==='api') {
|
|
202
202
|
let swaggerOptions = {
|
|
@@ -259,27 +259,25 @@ function iService (userRouteTable, useDefault, asset, allAppEnv, serverMode, use
|
|
|
259
259
|
|
|
260
260
|
async function getCertificates () {
|
|
261
261
|
|
|
262
|
-
let
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
if (fs.existsSync(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+
let options = null;
|
|
263
|
+
let tlsdir = process.env.SSLCERT;
|
|
264
|
+
if (tlsdir != null && tlsdir.trim().length > 0) {
|
|
265
|
+
console.log('ssl CERTIFICATES', tlsdir);
|
|
266
|
+
if (fs.existsSync(`${tlsdir}/key.pem`) === true) {
|
|
267
|
+
options = {};
|
|
268
|
+
options.key = fs.readFileSync(`${tlsdir}/key.pem`, { encoding: 'utf8' });
|
|
269
|
+
options.cert = fs.readFileSync(`${tlsdir}/crt.pem`, { encoding: 'utf8' });
|
|
270
|
+
if (fs.existsSync(`${tlsdir}/ca.pem`) === true) {
|
|
271
|
+
options.ca = fs.readFileSync(`${tlsdir}/ca.pem`, { encoding: 'utf8' });
|
|
272
|
+
}
|
|
273
|
+
options.rejectUnauthorized= true;
|
|
270
274
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
console.log('Creating selfsigned certificate');
|
|
276
|
-
debug2('TLS set: TLS_CREATE=', process.env.TLS_CREATE);
|
|
277
|
-
tls = await getTls();
|
|
275
|
+
} else {
|
|
276
|
+
console.log('No SSL certificates found, generating self-signed certificates');
|
|
277
|
+
options = await getTls();
|
|
278
|
+
options.rejectUnauthorized= false;
|
|
278
279
|
}
|
|
279
|
-
|
|
280
|
-
console.log('Warning: The current host protocol is https: No TLS certificate information has been specified.');
|
|
281
|
-
}
|
|
282
|
-
return tls;
|
|
280
|
+
return options;
|
|
283
281
|
}
|
|
284
282
|
|
|
285
283
|
async function getTls () {
|
|
@@ -66,17 +66,6 @@ module.exports = function setDefaultRoutes(server, options) {
|
|
|
66
66
|
: null;
|
|
67
67
|
|
|
68
68
|
let defaultTable = [
|
|
69
|
-
{
|
|
70
|
-
method: ["GET"],
|
|
71
|
-
path: `/health`,
|
|
72
|
-
options: {
|
|
73
|
-
auth: false,
|
|
74
|
-
handler: async (req, h) => {
|
|
75
|
-
return h.response({ x: 1 }).code(200);
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
|
|
80
69
|
{
|
|
81
70
|
method: ["GET"],
|
|
82
71
|
path: `${appName}/logon`,
|