- Add ability to disable ipv6, fixes #312

- Added ipv6 listening to hosts when configured, fixes #236 and #149
- Added documentation about disabling ipv6
- Updated npm packages
This commit is contained in:
Jamie Curnow
2020-04-07 10:43:19 +10:00
parent 2a2d3d57ec
commit bdb591af9e
13 changed files with 1090 additions and 608 deletions

View File

@ -224,6 +224,9 @@ const internalNginx = {
locationsPromise = Promise.resolve();
}
// Set the IPv6 setting for the host
host.ipv6 = internalNginx.ipv6Enabled();
locationsPromise.then(() => {
renderEngine
.parseAndRender(template, host)
@ -396,6 +399,18 @@ const internalNginx = {
*/
advancedConfigHasDefaultLocation: function (config) {
return !!config.match(/^(?:.*;)?\s*?location\s*?\/\s*?{/im);
},
/**
* @returns {boolean}
*/
ipv6Enabled: function () {
if (typeof process.env.DISABLE_IPV6 !== 'undefined') {
const disabled = process.env.DISABLE_IPV6.toLowerCase();
return !(disabled === 'on' || disabled === 'true' || disabled === '1' || disabled === 'yes');
}
return true;
}
};