navy 4.1.2-rc.2 → 5.0.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/lib/cli/config/index.js +57 -241
- package/lib/cli/config/wrapper.js +12 -36
- package/lib/cli/develop.js +63 -167
- package/lib/cli/doctor/clean-compose-files.js +19 -73
- package/lib/cli/doctor/index.js +34 -154
- package/lib/cli/doctor/invalid-compose-config.js +20 -110
- package/lib/cli/doctor/invalid-state.js +22 -115
- package/lib/cli/doctor/util.js +26 -93
- package/lib/cli/external-ip.js +9 -39
- package/lib/cli/health.js +18 -67
- package/lib/cli/https.js +92 -0
- package/lib/cli/import.js +22 -59
- package/lib/cli/index.js +11 -17
- package/lib/cli/lan-ip.js +18 -60
- package/lib/cli/launch.js +46 -127
- package/lib/cli/live.js +37 -111
- package/lib/cli/local-ip.js +16 -53
- package/lib/cli/logs.js +7 -35
- package/lib/cli/open.js +11 -45
- package/lib/cli/program.js +145 -167
- package/lib/cli/ps.js +36 -105
- package/lib/cli/refresh-config.js +18 -62
- package/lib/cli/run.js +8 -39
- package/lib/cli/status.js +41 -201
- package/lib/cli/updates.js +68 -160
- package/lib/cli/util/get-or-initialise-navy.js +14 -57
- package/lib/cli/util/import.js +33 -83
- package/lib/cli/util/index.js +10 -12
- package/lib/cli/util/reconfigure.js +12 -102
- package/lib/cli/wait-for-healthy.js +53 -100
- package/lib/config-provider.js +25 -127
- package/lib/config-providers/filesystem/index.js +58 -235
- package/lib/config-providers/npm/__tests__/util.js +3 -6
- package/lib/config-providers/npm/index.js +60 -231
- package/lib/config-providers/npm/util.js +6 -9
- package/lib/config.js +39 -76
- package/lib/driver-logging.js +23 -28
- package/lib/driver.js +5 -7
- package/lib/drivers/docker-compose/client.js +64 -172
- package/lib/drivers/docker-compose/index.js +153 -464
- package/lib/errors.js +27 -61
- package/lib/http-proxy.js +72 -158
- package/lib/index.js +26 -29
- package/lib/middleware/add-service-proxy-config.js +76 -0
- package/lib/middleware/develop.js +9 -23
- package/lib/middleware/helpers.js +20 -25
- package/lib/middleware/port-override.js +15 -37
- package/lib/middleware/set-env-vars.js +14 -18
- package/lib/middleware/set-image.js +12 -18
- package/lib/middleware/set-logging-driver.js +14 -18
- package/lib/middleware/tag-override.js +11 -19
- package/lib/navy/default-middleware.js +13 -27
- package/lib/navy/index.js +438 -1761
- package/lib/navy/middleware.js +15 -100
- package/lib/navy/plugin-interface.js +28 -108
- package/lib/navy/state.js +58 -147
- package/lib/navy/util.js +2 -1
- package/lib/service.js +5 -3
- package/lib/util/__tests__/external-ip.js +20 -96
- package/lib/util/__tests__/registry-client.js +11 -24
- package/lib/util/__tests__/service-host.js +19 -116
- package/lib/util/docker-client.js +10 -13
- package/lib/util/exec-async.js +9 -27
- package/lib/util/external-ip.js +48 -126
- package/lib/util/fs.js +7 -6
- package/lib/util/get-lan-ip.js +15 -52
- package/lib/util/has-update.js +23 -73
- package/lib/util/https.js +213 -0
- package/lib/util/navyrc.js +12 -50
- package/lib/util/registry-client.js +41 -112
- package/lib/util/service-host.js +40 -129
- package/lib/util/table.js +11 -21
- package/package.json +14 -14
- package/LICENSE +0 -21
- package/lib/middleware/add-virtual-hosts.js +0 -147
package/lib/util/service-host.js
CHANGED
|
@@ -1,123 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
4
|
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
|
11
|
-
|
|
12
|
-
var _regenerator = require('babel-runtime/regenerator');
|
|
13
|
-
|
|
14
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
|
15
|
-
|
|
16
|
-
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
|
8
|
+
exports.createHostForService = createHostForService;
|
|
9
|
+
exports.createUrlForService = createUrlForService;
|
|
10
|
+
exports.getNIPSubdomain = getNIPSubdomain;
|
|
11
|
+
exports.getUrlFromService = getUrlFromService;
|
|
17
12
|
|
|
18
|
-
var
|
|
13
|
+
var _https = require("./https");
|
|
19
14
|
|
|
20
|
-
var
|
|
21
|
-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(externalIP) {
|
|
22
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
23
|
-
while (1) {
|
|
24
|
-
switch (_context.prev = _context.next) {
|
|
25
|
-
case 0:
|
|
26
|
-
if (isValidIpv4Addr(externalIP)) {
|
|
27
|
-
_context.next = 2;
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
15
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
const BASE = 'nip.io';
|
|
32
18
|
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
function isValidIpv4Addr(ip) {
|
|
20
|
+
return /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g.test(ip);
|
|
21
|
+
}
|
|
35
22
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, _callee, this);
|
|
42
|
-
}));
|
|
43
|
-
|
|
44
|
-
return function getNIPSubdomain(_x) {
|
|
45
|
-
return _ref.apply(this, arguments);
|
|
46
|
-
};
|
|
47
|
-
}();
|
|
48
|
-
|
|
49
|
-
var createHostForService = exports.createHostForService = function () {
|
|
50
|
-
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(service, navyNormalisedName, externalIP) {
|
|
51
|
-
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
|
52
|
-
while (1) {
|
|
53
|
-
switch (_context2.prev = _context2.next) {
|
|
54
|
-
case 0:
|
|
55
|
-
_context2.t0 = service + '.' + navyNormalisedName + '.';
|
|
56
|
-
_context2.t1 = process.env.NAVY_EXTERNAL_SUBDOMAIN;
|
|
57
|
-
|
|
58
|
-
if (_context2.t1) {
|
|
59
|
-
_context2.next = 6;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
_context2.next = 5;
|
|
64
|
-
return getNIPSubdomain(externalIP);
|
|
65
|
-
|
|
66
|
-
case 5:
|
|
67
|
-
_context2.t1 = _context2.sent;
|
|
68
|
-
|
|
69
|
-
case 6:
|
|
70
|
-
_context2.t2 = _context2.t1;
|
|
71
|
-
return _context2.abrupt('return', _context2.t0 + _context2.t2);
|
|
72
|
-
|
|
73
|
-
case 8:
|
|
74
|
-
case 'end':
|
|
75
|
-
return _context2.stop();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}, _callee2, this);
|
|
79
|
-
}));
|
|
80
|
-
|
|
81
|
-
return function createHostForService(_x2, _x3, _x4) {
|
|
82
|
-
return _ref2.apply(this, arguments);
|
|
83
|
-
};
|
|
84
|
-
}();
|
|
85
|
-
|
|
86
|
-
var createUrlForService = exports.createUrlForService = function () {
|
|
87
|
-
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(service, navyNormalisedName, externalIP) {
|
|
88
|
-
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
|
89
|
-
while (1) {
|
|
90
|
-
switch (_context3.prev = _context3.next) {
|
|
91
|
-
case 0:
|
|
92
|
-
_context3.next = 2;
|
|
93
|
-
return createHostForService(service, navyNormalisedName, externalIP);
|
|
94
|
-
|
|
95
|
-
case 2:
|
|
96
|
-
_context3.t0 = _context3.sent;
|
|
97
|
-
return _context3.abrupt('return', 'http://' + _context3.t0);
|
|
98
|
-
|
|
99
|
-
case 4:
|
|
100
|
-
case 'end':
|
|
101
|
-
return _context3.stop();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, _callee3, this);
|
|
105
|
-
}));
|
|
23
|
+
async function getNIPSubdomain(externalIP) {
|
|
24
|
+
if (!isValidIpv4Addr(externalIP)) {
|
|
25
|
+
// invalid IP address, fallback to local
|
|
26
|
+
return `127.0.0.1.${BASE}`;
|
|
27
|
+
}
|
|
106
28
|
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
};
|
|
110
|
-
}();
|
|
29
|
+
return `${externalIP}.${BASE}`;
|
|
30
|
+
}
|
|
111
31
|
|
|
112
|
-
|
|
32
|
+
async function createHostForService(service, navyNormalisedName, externalIP) {
|
|
33
|
+
return `${service}.${navyNormalisedName}.${process.env.NAVY_EXTERNAL_SUBDOMAIN || (await getNIPSubdomain(externalIP))}`;
|
|
34
|
+
}
|
|
113
35
|
|
|
114
|
-
function
|
|
36
|
+
async function createUrlForService(service, navyNormalisedName, externalIP) {
|
|
37
|
+
const certsPath = (0, _https.getCertsPath)();
|
|
38
|
+
let proto = 'http';
|
|
39
|
+
const baseUrl = await createHostForService(service, navyNormalisedName, externalIP);
|
|
115
40
|
|
|
116
|
-
|
|
41
|
+
if (_fs.default.existsSync(`${certsPath}/${baseUrl}.crt`)) {
|
|
42
|
+
proto = 'https';
|
|
43
|
+
}
|
|
117
44
|
|
|
118
|
-
|
|
119
|
-
return (/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g.test(ip)
|
|
120
|
-
);
|
|
45
|
+
return `${proto}://${await createHostForService(service, navyNormalisedName, externalIP)}`;
|
|
121
46
|
}
|
|
122
47
|
|
|
123
48
|
function getUrlFromService(service) {
|
|
@@ -125,32 +50,18 @@ function getUrlFromService(service) {
|
|
|
125
50
|
return null;
|
|
126
51
|
}
|
|
127
52
|
|
|
128
|
-
|
|
53
|
+
const env = service.raw.Config.Env;
|
|
54
|
+
const certsPath = (0, _https.getCertsPath)();
|
|
129
55
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
56
|
+
for (const envVar of env) {
|
|
57
|
+
if (envVar.indexOf('VIRTUAL_HOST=') === 0) {
|
|
58
|
+
let proto = 'http';
|
|
133
59
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var envVar = _step.value;
|
|
137
|
-
|
|
138
|
-
if (envVar.indexOf('VIRTUAL_HOST=') === 0) {
|
|
139
|
-
return 'http://' + envVar.substring('VIRTUAL_HOST='.length);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
} catch (err) {
|
|
143
|
-
_didIteratorError = true;
|
|
144
|
-
_iteratorError = err;
|
|
145
|
-
} finally {
|
|
146
|
-
try {
|
|
147
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
148
|
-
_iterator.return();
|
|
149
|
-
}
|
|
150
|
-
} finally {
|
|
151
|
-
if (_didIteratorError) {
|
|
152
|
-
throw _iteratorError;
|
|
60
|
+
if (_fs.default.existsSync(`${certsPath}/${envVar.substring('VIRTUAL_HOST='.length)}.crt`)) {
|
|
61
|
+
proto = 'https';
|
|
153
62
|
}
|
|
63
|
+
|
|
64
|
+
return proto + '://' + envVar.substring('VIRTUAL_HOST='.length);
|
|
154
65
|
}
|
|
155
66
|
}
|
|
156
67
|
|
package/lib/util/table.js
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
4
|
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.default = table;
|
|
7
9
|
|
|
8
|
-
var _pad = require(
|
|
9
|
-
|
|
10
|
-
var _pad2 = _interopRequireDefault(_pad);
|
|
11
|
-
|
|
12
|
-
var _stripAnsi = require('strip-ansi');
|
|
10
|
+
var _pad = _interopRequireDefault(require("pad"));
|
|
13
11
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
var _stripAnsi = _interopRequireDefault(require("strip-ansi"));
|
|
17
13
|
|
|
18
14
|
function table(rows) {
|
|
19
15
|
if (rows.length === 0) {
|
|
20
16
|
return '';
|
|
21
17
|
}
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return rows.map(function (row) {
|
|
31
|
-
return row.map(function (col, colIndex) {
|
|
32
|
-
return (0, _pad2.default)(col || '', colSizes[colIndex], { colors: true });
|
|
33
|
-
}).join('');
|
|
34
|
-
}).join('\n');
|
|
19
|
+
const cols = rows[0];
|
|
20
|
+
const colSizes = cols.map((col, colIndex) => rows.reduce((currentSize, row) => currentSize = Math.max(currentSize, (0, _stripAnsi.default)(row[colIndex] || '').length), 0) + 2);
|
|
21
|
+
return rows.map(row => row.map((col, colIndex) => (0, _pad.default)(col || '', colSizes[colIndex], {
|
|
22
|
+
colors: true
|
|
23
|
+
})).join('')).join('\n');
|
|
35
24
|
}
|
|
25
|
+
|
|
36
26
|
module.exports = exports.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "navy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Quick and powerful development environments using Docker and Docker Compose",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -25,26 +25,26 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/momentumft/navy#readme",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"babel
|
|
28
|
+
"@babel/runtime": "^7",
|
|
29
29
|
"bluebird": "^3.7.2",
|
|
30
30
|
"chalk": "^1.1.3",
|
|
31
|
-
"cli-spinners": "^
|
|
31
|
+
"cli-spinners": "^2.6.1",
|
|
32
32
|
"commander": "^2.20.3",
|
|
33
33
|
"debug": "^2.2.0",
|
|
34
|
-
"dockerode": "^3.1
|
|
35
|
-
"eventemitter2": "^
|
|
36
|
-
"inquirer": "^3.
|
|
34
|
+
"dockerode": "^3.3.1",
|
|
35
|
+
"eventemitter2": "^6.4.5",
|
|
36
|
+
"inquirer": "^7.3.3",
|
|
37
37
|
"invariant": "^2.2.4",
|
|
38
|
-
"js-yaml": "^3.
|
|
39
|
-
"lodash": "^4.17.
|
|
40
|
-
"mkdirp": "^0.5.
|
|
38
|
+
"js-yaml": "^3.14.1",
|
|
39
|
+
"lodash": "^4.17.21",
|
|
40
|
+
"mkdirp": "^0.5.5",
|
|
41
|
+
"node-forge": "^0.10.0",
|
|
41
42
|
"opn": "^5.5.0",
|
|
42
|
-
"pad": "^
|
|
43
|
+
"pad": "^3.2.0",
|
|
43
44
|
"promise-retry": "^1.1.1",
|
|
44
|
-
"resolve": "^1.
|
|
45
|
+
"resolve": "^1.20.0",
|
|
45
46
|
"rimraf": "^2.7.1",
|
|
46
|
-
"simple-docker-registry-client": "^1.1.
|
|
47
|
+
"simple-docker-registry-client": "^1.1.2",
|
|
47
48
|
"strip-ansi": "^3.0.1"
|
|
48
|
-
}
|
|
49
|
-
"gitHead": "c68c17c6ea41bb6e88675f5f8f09270a70e71990"
|
|
49
|
+
}
|
|
50
50
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016 Momentum Financial Technology Ltd.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _regenerator = require('babel-runtime/regenerator');
|
|
8
|
-
|
|
9
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
|
10
|
-
|
|
11
|
-
var _extends2 = require('babel-runtime/helpers/extends');
|
|
12
|
-
|
|
13
|
-
var _extends3 = _interopRequireDefault(_extends2);
|
|
14
|
-
|
|
15
|
-
var _keys = require('babel-runtime/core-js/object/keys');
|
|
16
|
-
|
|
17
|
-
var _keys2 = _interopRequireDefault(_keys);
|
|
18
|
-
|
|
19
|
-
var _promise = require('babel-runtime/core-js/promise');
|
|
20
|
-
|
|
21
|
-
var _promise2 = _interopRequireDefault(_promise);
|
|
22
|
-
|
|
23
|
-
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
|
24
|
-
|
|
25
|
-
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
|
26
|
-
|
|
27
|
-
var _lodash = require('lodash');
|
|
28
|
-
|
|
29
|
-
var _serviceHost = require('../util/service-host');
|
|
30
|
-
|
|
31
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
-
|
|
33
|
-
var getServiceHTTPProxyConfig = function getServiceHTTPProxyConfig(serviceName, navyFile) {
|
|
34
|
-
if (navyFile && navyFile.httpProxy && navyFile.httpProxy[serviceName]) {
|
|
35
|
-
return navyFile.httpProxy[serviceName];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return null;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
var serviceHasPort80 = function serviceHasPort80(service) {
|
|
42
|
-
return service.ports && (0, _lodash.find)(service.ports, function (port) {
|
|
43
|
-
return (
|
|
44
|
-
// Should handle "80" (short syntax), "80:80" (long syntax), and "80/tcp" (including protocol) formats.
|
|
45
|
-
port.toString() === '80' || port.toString().startsWith('80:') || port.toString().startsWith('80/')
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
exports.default = function (navy) {
|
|
51
|
-
return function () {
|
|
52
|
-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(config, state) {
|
|
53
|
-
var navyFile, services, externalIP;
|
|
54
|
-
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
|
55
|
-
while (1) {
|
|
56
|
-
switch (_context2.prev = _context2.next) {
|
|
57
|
-
case 0:
|
|
58
|
-
_context2.next = 2;
|
|
59
|
-
return navy.getNavyFile();
|
|
60
|
-
|
|
61
|
-
case 2:
|
|
62
|
-
navyFile = _context2.sent;
|
|
63
|
-
services = {};
|
|
64
|
-
_context2.next = 6;
|
|
65
|
-
return navy.externalIP();
|
|
66
|
-
|
|
67
|
-
case 6:
|
|
68
|
-
externalIP = _context2.sent;
|
|
69
|
-
_context2.next = 9;
|
|
70
|
-
return _promise2.default.all((0, _keys2.default)(config.services).map(function () {
|
|
71
|
-
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(serviceName) {
|
|
72
|
-
var service, proxyConfig;
|
|
73
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
74
|
-
while (1) {
|
|
75
|
-
switch (_context.prev = _context.next) {
|
|
76
|
-
case 0:
|
|
77
|
-
service = config.services[serviceName];
|
|
78
|
-
proxyConfig = getServiceHTTPProxyConfig(serviceName, navyFile);
|
|
79
|
-
|
|
80
|
-
// proxy port 80 even without config
|
|
81
|
-
|
|
82
|
-
if (!proxyConfig && serviceHasPort80(service)) {
|
|
83
|
-
proxyConfig = { port: 80 };
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!proxyConfig) {
|
|
87
|
-
_context.next = 17;
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
_context.t0 = _extends3.default;
|
|
92
|
-
_context.t1 = {};
|
|
93
|
-
_context.t2 = service;
|
|
94
|
-
_context.t3 = _extends3.default;
|
|
95
|
-
_context.next = 10;
|
|
96
|
-
return (0, _serviceHost.createHostForService)(serviceName, navy.normalisedName, externalIP);
|
|
97
|
-
|
|
98
|
-
case 10:
|
|
99
|
-
_context.t4 = _context.sent;
|
|
100
|
-
_context.t5 = proxyConfig.port;
|
|
101
|
-
_context.t6 = {
|
|
102
|
-
'VIRTUAL_HOST': _context.t4,
|
|
103
|
-
'VIRTUAL_PORT': _context.t5
|
|
104
|
-
};
|
|
105
|
-
_context.t7 = service.environment;
|
|
106
|
-
_context.t8 = (0, _context.t3)(_context.t6, _context.t7);
|
|
107
|
-
_context.t9 = {
|
|
108
|
-
environment: _context.t8
|
|
109
|
-
};
|
|
110
|
-
return _context.abrupt('return', services[serviceName] = (0, _context.t0)(_context.t1, _context.t2, _context.t9));
|
|
111
|
-
|
|
112
|
-
case 17:
|
|
113
|
-
return _context.abrupt('return', services[serviceName] = service);
|
|
114
|
-
|
|
115
|
-
case 18:
|
|
116
|
-
case 'end':
|
|
117
|
-
return _context.stop();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}, _callee, undefined);
|
|
121
|
-
}));
|
|
122
|
-
|
|
123
|
-
return function (_x3) {
|
|
124
|
-
return _ref2.apply(this, arguments);
|
|
125
|
-
};
|
|
126
|
-
}()));
|
|
127
|
-
|
|
128
|
-
case 9:
|
|
129
|
-
return _context2.abrupt('return', (0, _extends3.default)({}, config, {
|
|
130
|
-
services: services
|
|
131
|
-
}));
|
|
132
|
-
|
|
133
|
-
case 10:
|
|
134
|
-
case 'end':
|
|
135
|
-
return _context2.stop();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}, _callee2, undefined);
|
|
139
|
-
}));
|
|
140
|
-
|
|
141
|
-
return function (_x, _x2) {
|
|
142
|
-
return _ref.apply(this, arguments);
|
|
143
|
-
};
|
|
144
|
-
}();
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
module.exports = exports.default;
|