2018-11-04 20:52:50 +00:00
|
|
|
'use strict';
|
|
|
|
|
2020-06-26 01:07:37 +00:00
|
|
|
const { getOptions, shouldNotRegisterESMLoader } = internalBinding('options');
|
2018-11-04 20:52:50 +00:00
|
|
|
const { options, aliases } = getOptions();
|
|
|
|
|
2020-04-18 18:25:04 +00:00
|
|
|
let warnOnAllowUnauthorized = true;
|
|
|
|
|
2018-11-04 20:52:50 +00:00
|
|
|
function getOptionValue(option) {
|
2021-01-15 09:46:42 +00:00
|
|
|
return options.get(option)?.value;
|
2018-11-04 20:52:50 +00:00
|
|
|
}
|
|
|
|
|
2020-04-18 18:25:04 +00:00
|
|
|
function getAllowUnauthorized() {
|
|
|
|
const allowUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0';
|
|
|
|
|
|
|
|
if (allowUnauthorized && warnOnAllowUnauthorized) {
|
|
|
|
warnOnAllowUnauthorized = false;
|
|
|
|
process.emitWarning(
|
|
|
|
'Setting the NODE_TLS_REJECT_UNAUTHORIZED ' +
|
|
|
|
'environment variable to \'0\' makes TLS connections ' +
|
|
|
|
'and HTTPS requests insecure by disabling ' +
|
|
|
|
'certificate verification.');
|
|
|
|
}
|
|
|
|
return allowUnauthorized;
|
|
|
|
}
|
|
|
|
|
2018-11-04 20:52:50 +00:00
|
|
|
module.exports = {
|
|
|
|
options,
|
|
|
|
aliases,
|
2020-04-18 18:25:04 +00:00
|
|
|
getOptionValue,
|
|
|
|
getAllowUnauthorized,
|
2020-06-26 01:07:37 +00:00
|
|
|
shouldNotRegisterESMLoader
|
2018-11-04 20:52:50 +00:00
|
|
|
};
|