()
| 39 | let noProxyDispatcher: Dispatcher | null = null; |
| 40 | |
| 41 | function readConfig(): ProxyConfig { |
| 42 | if (cachedConfig) return cachedConfig; |
| 43 | const env = process.env; |
| 44 | const httpsProxy = env.HTTPS_PROXY || env.https_proxy || env.ALL_PROXY || env.all_proxy; |
| 45 | const httpProxy = env.HTTP_PROXY || env.http_proxy || env.ALL_PROXY || env.all_proxy; |
| 46 | const noProxyRaw = env.NO_PROXY || env.no_proxy || ''; |
| 47 | const noProxy = noProxyRaw.split(',').map(s => s.trim().toLowerCase()).filter(Boolean); |
| 48 | cachedConfig = { httpsProxy, httpProxy, noProxy }; |
| 49 | if (httpsProxy || httpProxy) { |
| 50 | logger.info('Proxy env detected', { httpsProxy: redact(httpsProxy), httpProxy: redact(httpProxy), noProxy }); |
| 51 | } |
| 52 | return cachedConfig; |
| 53 | } |
| 54 | |
| 55 | function redact(url: string | undefined): string | undefined { |
| 56 | if (!url) return url; |
no test coverage detected