@sassoftware/viya-serverjs 0.0.2 → 0.0.3
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/lib/core/config.js
CHANGED
|
@@ -25,6 +25,12 @@ exports["default"] = void 0;
|
|
|
25
25
|
var _parseDocker = _interopRequireDefault(require("./parseDocker"));
|
|
26
26
|
var _debug = _interopRequireDefault(require("debug"));
|
|
27
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
30
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
33
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
34
|
var fs = require('fs');
|
|
29
35
|
var configDebug = (0, _debug["default"])('config');
|
|
30
36
|
function config(appEnv, dockerFile) {
|
|
@@ -82,12 +88,18 @@ function iconfig(appEnv) {
|
|
|
82
88
|
var d = data.split(/\r?\n/);
|
|
83
89
|
d.forEach(function (l) {
|
|
84
90
|
if (l.length > 0 && l.indexOf('#') === -1) {
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
var _l$split = l.split('='),
|
|
92
|
+
_l$split2 = _slicedToArray(_l$split, 2),
|
|
93
|
+
envName = _l$split2[0],
|
|
94
|
+
value = _l$split2[1];
|
|
95
|
+
if (value.trim().length > 0) {
|
|
96
|
+
if (value.startsWith('$')) {
|
|
97
|
+
var envVar = value.substring(1);
|
|
98
|
+
value = process.env[envVar];
|
|
99
|
+
}
|
|
100
|
+
process.env[envName] = value;
|
|
89
101
|
}
|
|
90
|
-
configDebug(
|
|
102
|
+
configDebug(envName, '=', value);
|
|
91
103
|
}
|
|
92
104
|
});
|
|
93
105
|
} catch (err) {
|
|
@@ -49,21 +49,11 @@ function _codeAuth() {
|
|
|
49
49
|
/* hmr support */
|
|
50
50
|
indexHTML = "/".concat(process.env.APPNAME, "/").concat(indexHTML);
|
|
51
51
|
}
|
|
52
|
-
return _context.abrupt("return",
|
|
53
|
-
status: true,
|
|
54
|
-
error: null,
|
|
55
|
-
target: 'redirect',
|
|
56
|
-
redirect: indexHTML
|
|
57
|
-
});
|
|
52
|
+
return _context.abrupt("return", h.redirect(indexHTML));
|
|
58
53
|
case 16:
|
|
59
54
|
// return h.file(indexHTML);
|
|
60
55
|
console.log('redirecting to :', "/".concat(indexHTML));
|
|
61
|
-
return _context.abrupt("return",
|
|
62
|
-
status: true,
|
|
63
|
-
error: null,
|
|
64
|
-
target: 'file',
|
|
65
|
-
redirect: indexHTML
|
|
66
|
-
});
|
|
56
|
+
return _context.abrupt("return", h.file(indexHTML));
|
|
67
57
|
case 18:
|
|
68
58
|
case "end":
|
|
69
59
|
return _context.stop();
|
|
@@ -19,7 +19,7 @@ function getApp(_x, _x2, _x3) {
|
|
|
19
19
|
}
|
|
20
20
|
function _getApp() {
|
|
21
21
|
_getApp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options, req, h) {
|
|
22
|
-
var authType,
|
|
22
|
+
var authType, indexHTML, handleImplicit, _handleImplicit;
|
|
23
23
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
24
24
|
while (1) switch (_context2.prev = _context2.next) {
|
|
25
25
|
case 0:
|
|
@@ -71,37 +71,22 @@ function _getApp() {
|
|
|
71
71
|
debug("calling handleImplicit");
|
|
72
72
|
return _context2.abrupt("return", handleImplicit(options, req, h));
|
|
73
73
|
case 9:
|
|
74
|
-
console.log("in getApp:****1 ", authType);
|
|
75
74
|
if (!(authType === "server")) {
|
|
76
|
-
_context2.next =
|
|
75
|
+
_context2.next = 14;
|
|
77
76
|
break;
|
|
78
77
|
}
|
|
79
78
|
debugger;
|
|
80
|
-
_context2.
|
|
81
|
-
return (0, _codeAuth["default"])(req, h, options);
|
|
79
|
+
return _context2.abrupt("return", (0, _codeAuth["default"])(req, h, options));
|
|
82
80
|
case 14:
|
|
83
|
-
status = _context2.sent;
|
|
84
|
-
if (!(status.target === "redirect")) {
|
|
85
|
-
_context2.next = 19;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
return _context2.abrupt("return", h.redirect(status.redirect));
|
|
89
|
-
case 19:
|
|
90
|
-
return _context2.abrupt("return", h.file(status.redirect));
|
|
91
|
-
case 20:
|
|
92
|
-
_context2.next = 27;
|
|
93
|
-
break;
|
|
94
|
-
case 22:
|
|
95
81
|
if (!(authType === null)) {
|
|
96
|
-
_context2.next =
|
|
82
|
+
_context2.next = 18;
|
|
97
83
|
break;
|
|
98
84
|
}
|
|
99
85
|
/* case of no auth */
|
|
100
|
-
debug("usecase: No authflow");
|
|
101
86
|
indexHTML = process.env.APPENTRY == null ? "index.html" : process.env.APPENTRY;
|
|
102
87
|
console.log("Redirecting to default ".concat(indexHTML));
|
|
103
88
|
return _context2.abrupt("return", h.file(indexHTML));
|
|
104
|
-
case
|
|
89
|
+
case 18:
|
|
105
90
|
case "end":
|
|
106
91
|
return _context2.stop();
|
|
107
92
|
}
|
|
@@ -17,6 +17,7 @@ function _proxyMapUri() {
|
|
|
17
17
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
18
18
|
while (1) switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
20
|
+
debugger;
|
|
20
21
|
credentials = req.auth.credentials;
|
|
21
22
|
console.log('------------------------------------------');
|
|
22
23
|
if (credentials != null) {
|
|
@@ -37,7 +38,7 @@ function _proxyMapUri() {
|
|
|
37
38
|
return _context.abrupt("return", {
|
|
38
39
|
uri: uri
|
|
39
40
|
});
|
|
40
|
-
case
|
|
41
|
+
case 14:
|
|
41
42
|
case "end":
|
|
42
43
|
return _context.stop();
|
|
43
44
|
}
|
|
@@ -44,7 +44,7 @@ function _setCookies() {
|
|
|
44
44
|
sid: sid,
|
|
45
45
|
user_name: ''
|
|
46
46
|
};
|
|
47
|
-
if (
|
|
47
|
+
if (process.env.USETOKEN === 'YES') {
|
|
48
48
|
options.allAppEnv.LOGONPAYLOAD.token = authCred.token;
|
|
49
49
|
options.allAppEnv.LOGONPAYLOAD.tokenType = 'bearer';
|
|
50
50
|
debug(options.allAppEnv.LOGONPAYLOAD);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sassoftware/viya-serverjs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "App server for Custom Viya Applications",
|
|
5
5
|
"author": "Deva Kumaraswamy <deva.kumar@sas.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,4 +32,5 @@
|
|
|
32
32
|
"pub": "npm publish --tag dev --access public",
|
|
33
33
|
"lint": "npx eslint --fix src/*.js"
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
}
|