Comparing version 4.2.1 to 4.2.2-rc.0
@@ -45,10 +45,16 @@ 'use strict'; | ||
var serviceHasPort80 = function serviceHasPort80(service) { | ||
return service.ports && (0, _lodash.find)(service.ports, function (portDefinition) { | ||
// In older versions of Docker Compose `ports` could just be an array of string/number, | ||
// but it's changed to e.g. {target: "80"} | ||
var port = (typeof portDefinition === 'undefined' ? 'undefined' : (0, _typeof3.default)(portDefinition)) === 'object' && 'target' in portDefinition ? portDefinition.target : portDefinition; | ||
var serviceGetAutoProxyPortOr80 = function serviceGetAutoProxyPortOr80(service, navyFile) { | ||
var autoPorts = navyFile && Array.isArray(navyFile.httpProxyAutoPorts) && navyFile.httpProxyAutoPorts || ['80']; | ||
return service.ports && (0, _lodash.find)(autoPorts, function (autoPort) { | ||
var autoPortString = autoPort.toString(); | ||
// Should handle "80" (short syntax), "80:80" (long syntax), and "80/tcp" (including protocol) formats. | ||
return port.toString() === '80' || port.toString().startsWith('80:') || port.toString().startsWith('80/'); | ||
return (0, _lodash.find)(service.ports, function (portDefinition) { | ||
// In older versions of Docker Compose `ports` could just be an array of string/number, | ||
// but it's changed to e.g. {target: "80"} | ||
var port = (typeof portDefinition === 'undefined' ? 'undefined' : (0, _typeof3.default)(portDefinition)) === 'object' && 'target' in portDefinition ? portDefinition.target : portDefinition; | ||
var portString = port.toString(); | ||
return portString === autoPortString || portString.startsWith(autoPortString + ':') || portString.startsWith(autoPortString + '/'); | ||
}); | ||
}); | ||
@@ -79,3 +85,3 @@ }; | ||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(serviceName) { | ||
var service, proxyConfig; | ||
var service, proxyConfig, autoPort; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
@@ -88,6 +94,10 @@ while (1) { | ||
// proxy port 80 even without config | ||
// proxy port 80 even without service config, or a different port with config httpProxyAutoPorts | ||
if (!proxyConfig && serviceHasPort80(service)) { | ||
proxyConfig = { port: 80 }; | ||
if (!proxyConfig) { | ||
autoPort = serviceGetAutoProxyPortOr80(service, navyFile); | ||
if (autoPort) { | ||
proxyConfig = { port: parseInt(autoPort) }; | ||
} | ||
} | ||
@@ -94,0 +104,0 @@ |
{ | ||
"name": "navy", | ||
"version": "4.2.1", | ||
"version": "4.2.2-rc.0", | ||
"description": "Quick and powerful development environments using Docker and Docker Compose", | ||
@@ -49,3 +49,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "1ded730a51612cca543c7c035ff14ad9b57cdf80" | ||
"gitHead": "ee51b90cf96a2c4884f450d92d5c8a807278d74e" | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
287348
6865
2