File tree Expand file tree Collapse file tree 2 files changed +2
-43
lines changed
packages/cubejs-backend-shared Expand file tree Collapse file tree 2 files changed +2
-43
lines changed Original file line number Diff line number Diff line change 4242 "decompress" : " ^4.2.1" ,
4343 "env-var" : " ^6.3.0" ,
4444 "fs-extra" : " ^9.1.0" ,
45- "https-proxy-agent" : " ^7.0.6" ,
4645 "lru-cache" : " ^11.1.0" ,
4746 "moment-range" : " ^4.0.2" ,
4847 "moment-timezone" : " ^0.5.47" ,
Original file line number Diff line number Diff line change 1- import { exec } from 'child_process' ;
21import { ProxyAgent } from 'proxy-agent' ;
3- import { HttpsProxyAgent } from 'https-proxy-agent' ;
4-
5- let npmProxy : string ;
6- let npmProxyInitialized = false ;
7-
8- function getCommandOutput ( command : string ) {
9- return new Promise < string > ( ( resolve , reject ) => {
10- exec ( command , ( error , stdout ) => {
11- if ( error ) {
12- reject ( error . message ) ;
13- return ;
14- }
15-
16- resolve ( stdout ) ;
17- } ) ;
18- } ) ;
19- }
20-
21- /**
22- * @deprecated
23- * use ProxyAgent instead
24- */
25- export async function getProxySettings ( ) : Promise < string > {
26- const [ proxy ] = (
27- await Promise . all ( [ getCommandOutput ( 'npm config -g get https-proxy' ) , getCommandOutput ( 'npm config -g get proxy' ) ] )
28- )
29- . map ( ( s ) => s . trim ( ) )
30- . filter ( ( s ) => ! [ 'null' , 'undefined' , '' ] . includes ( s ) ) ;
31-
32- npmProxyInitialized = true ;
33-
34- return proxy ;
35- }
362
373export async function getHttpAgentForProxySettings ( ) {
38- if ( ! npmProxyInitialized ) {
39- npmProxy = await getProxySettings ( ) ;
4+ if ( ! process . env . HTTP_PROXY && ! process . env . HTTPS_PROXY ) {
5+ return undefined ;
406 }
41-
42- if ( npmProxy ) {
43- console . warn ( 'Npm proxy settings are deprecated. Please use HTTP_PROXY, HTTPS_PROXY environment variables instead.' ) ;
44- return new HttpsProxyAgent ( npmProxy ) ;
45- }
46-
477 return new ProxyAgent ( ) ;
488}
You can’t perform that action at this time.
0 commit comments