@@ -11,7 +11,7 @@ import {CICDVariable} from "./variables-from-files.js";
1111import { GitData , GitSchema } from "./git-data.js" ;
1212import globby from "globby" ;
1313import micromatch from "micromatch" ;
14- import axios from "axios" ;
14+ import axios , { AxiosRequestConfig } from "axios" ;
1515import path from "path" ;
1616import { Argv } from "./argv.js" ;
1717
@@ -418,7 +418,11 @@ export class Utils {
418418 case "http" :
419419 case "https" : {
420420 try {
421- const { status} = await axios . get ( `${ protocol } ://${ domain } :${ port } /${ projectPath } /-/raw/${ ref } /${ file } ` ) ;
421+ const axiosConfig : AxiosRequestConfig = Utils . getAxiosProxyConfig ( ) ;
422+ const { status} = await axios . get (
423+ `${ protocol } ://${ domain } :${ port } /${ projectPath } /-/raw/${ ref } /${ file } ` ,
424+ axiosConfig ,
425+ ) ;
422426 return ( status === 200 ) ;
423427 } catch {
424428 return false ;
@@ -442,4 +446,19 @@ export class Utils {
442446 }
443447 return lsFilesRes . stdout . split ( "\n" ) ;
444448 }
449+
450+ static getAxiosProxyConfig ( ) : AxiosRequestConfig {
451+ const proxyEnv = process . env . HTTPS_PROXY || process . env . HTTP_PROXY ;
452+ if ( proxyEnv ) {
453+ const proxyUrl = new URL ( proxyEnv ) ;
454+ return {
455+ proxy : {
456+ host : proxyUrl . hostname ,
457+ port : proxyUrl . port ? parseInt ( proxyUrl . port , 10 ) : 8080 ,
458+ protocol : proxyUrl . protocol . replace ( ":" , "" ) ,
459+ } ,
460+ } ;
461+ }
462+ return { } ;
463+ }
445464}
0 commit comments