File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Diagnostics ;
23using System . IO ;
34using Semmle . Util ;
5+ using Semmle . Util . Logging ;
46
57namespace Semmle . Extraction . CSharp . DependencyFetching
68{
@@ -49,5 +51,17 @@ internal DependabotProxy(TemporaryDirectory tempWorkingDirectory)
4951 using var writer = this . certFile . CreateText ( ) ;
5052 writer . Write ( cert ) ;
5153 }
54+
55+ internal void ApplyProxy ( ILogger logger , ProcessStartInfo startInfo )
56+ {
57+ // If the proxy isn't configured, we have nothing to do.
58+ if ( ! this . IsConfigured ) return ;
59+
60+ logger . LogInfo ( $ "Setting up Dependabot proxy at { this . Address } ") ;
61+
62+ startInfo . EnvironmentVariables [ "HTTP_PROXY" ] = this . Address ;
63+ startInfo . EnvironmentVariables [ "HTTPS_PROXY" ] = this . Address ;
64+ startInfo . EnvironmentVariables [ "SSL_CERT_FILE" ] = this . certFile ? . FullName ;
65+ }
5266 }
5367}
Original file line number Diff line number Diff line change @@ -44,10 +44,6 @@ private ProcessStartInfo MakeDotnetStartInfo(string args, string? workingDirecto
4444 // Configure the proxy settings, if applicable.
4545 this . proxy . ApplyProxy ( this . logger , startInfo ) ;
4646
47- this . logger . LogInfo ( startInfo . EnvironmentVariables [ "HTTP_PROXY" ] ?? "" ) ;
48- this . logger . LogInfo ( startInfo . EnvironmentVariables [ "HTTPS_PROXY" ] ?? "" ) ;
49- this . logger . LogInfo ( startInfo . EnvironmentVariables [ "SSL_CERT_FILE" ] ?? "" ) ;
50-
5147 return startInfo ;
5248 }
5349
You can’t perform that action at this time.
0 commit comments