• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const { getOptions, shouldNotRegisterESMLoader } = internalBinding('options');
4const { options, aliases } = getOptions();
5
6let warnOnAllowUnauthorized = true;
7
8function getOptionValue(option) {
9  const result = options.get(option);
10  if (!result) {
11    return undefined;
12  }
13  return result.value;
14}
15
16function getAllowUnauthorized() {
17  const allowUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0';
18
19  if (allowUnauthorized && warnOnAllowUnauthorized) {
20    warnOnAllowUnauthorized = false;
21    process.emitWarning(
22      'Setting the NODE_TLS_REJECT_UNAUTHORIZED ' +
23      'environment variable to \'0\' makes TLS connections ' +
24      'and HTTPS requests insecure by disabling ' +
25      'certificate verification.');
26  }
27  return allowUnauthorized;
28}
29
30module.exports = {
31  options,
32  aliases,
33  getOptionValue,
34  getAllowUnauthorized,
35  shouldNotRegisterESMLoader
36};
37