mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
cli: add --use-env-proxy
This does the same as NODE_USE_ENV_PROXY. When both are set, like other options that can be configured from both sides, the CLI flag takes precedence. PR-URL: https://github.com/nodejs/node/pull/59151 Fixes: https://github.com/nodejs/node/issues/59100 Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
@@ -70,6 +70,7 @@ const { URL, urlToHttpOptions, isURL } = require('internal/url');
|
||||
const { validateObject } = require('internal/validators');
|
||||
const { isIP, isIPv6 } = require('internal/net');
|
||||
const assert = require('internal/assert');
|
||||
const { getOptionValue } = require('internal/options');
|
||||
|
||||
function Server(opts, requestListener) {
|
||||
if (!(this instanceof Server)) return new Server(opts, requestListener);
|
||||
@@ -599,7 +600,8 @@ Agent.prototype._evictSession = function _evictSession(key) {
|
||||
|
||||
const globalAgent = new Agent({
|
||||
keepAlive: true, scheduling: 'lifo', timeout: 5000,
|
||||
proxyEnv: process.env.NODE_USE_ENV_PROXY ? filterEnvForProxies(process.env) : undefined,
|
||||
// This normalized from both --use-env-proxy and NODE_USE_ENV_PROXY settings.
|
||||
proxyEnv: getOptionValue('--use-env-proxy') ? filterEnvForProxies(process.env) : undefined,
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user