import is from '@sindresorhus/is' ; import { createGlobalProxyAgent } from 'global-agent' ; const envVars = [ 'HTTP_PROXY' , 'HTTPS_PROXY' , 'NO_PROXY' ] ; let agent = false ; export function bootstrap ( ) { envVars . forEach ( ( envVar ) => { if ( typeof process . env [ envVar ] === 'undefined' && typeof process . env [ envVar . toLowerCase ( ) ] !== 'undefined' ) { process . env [ envVar ] = process . env [ envVar . toLowerCase ( ) ] ; } if ( process . env [ envVar ] ) { process . env [ envVar . toLowerCase ( ) ] = process . env [ envVar ] ; } } ) ; if ( is . nonEmptyString ( process . env . HTTP_PROXY ) || is . nonEmptyString ( process . env . HTTPS_PROXY ) ) { createGlobalProxyAgent ( { environmentVariableNamespace : '' , } ) ; agent = true ; } else { agent = false ; } } export function hasProxy ( ) { return agent === true ; }