File tree Expand file tree Collapse file tree
apps/generator-cli/src/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Inject , Module , OnApplicationBootstrap } from '@nestjs/common' ;
22import { HttpModule , HttpModuleOptions } from '@nestjs/axios' ;
33import { Command } from 'commander' ;
4+ import { ProxyAgent } from 'proxy-agent' ;
45
56import { COMMANDER_PROGRAM , LOGGER } from './constants' ;
67import { VersionManagerController } from './controllers/version-manager.controller' ;
@@ -15,19 +16,16 @@ import {
1516const hasHttpProxyEnvs = process . env . HTTP_PROXY || process . env . http_proxy ;
1617const hasHttpsProxyEnvs = process . env . HTTPS_PROXY || process . env . https_proxy ;
1718const httpModuleConfig : HttpModuleOptions = { } ;
19+ const proxyAgent = new ProxyAgent ( ) ;
1820
1921if ( hasHttpProxyEnvs ) {
2022 httpModuleConfig . proxy = false ;
21- // eslint-disable-next-line @typescript-eslint/no-var-requires
22- const ProxyAgent = require ( 'proxy-agent' ) . default ?? require ( 'proxy-agent' ) ;
23- httpModuleConfig . httpAgent = new ProxyAgent ( ) ;
23+ httpModuleConfig . httpAgent = proxyAgent ;
2424}
2525
2626if ( hasHttpsProxyEnvs ) {
2727 httpModuleConfig . proxy = false ;
28- // eslint-disable-next-line @typescript-eslint/no-var-requires
29- const ProxyAgent = require ( 'proxy-agent' ) . default ?? require ( 'proxy-agent' ) ;
30- httpModuleConfig . httpsAgent = new ProxyAgent ( ) ;
28+ httpModuleConfig . httpsAgent = proxyAgent ;
3129}
3230
3331@Module ( {
You can’t perform that action at this time.
0 commit comments