mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C#: Set environment variables for proxy for calls to dotnet
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Semmle.Util;
|
||||
using Semmle.Util.Logging;
|
||||
|
||||
namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
{
|
||||
@@ -49,5 +51,17 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
using var writer = this.certFile.CreateText();
|
||||
writer.Write(cert);
|
||||
}
|
||||
|
||||
internal void ApplyProxy(ILogger logger, ProcessStartInfo startInfo)
|
||||
{
|
||||
// If the proxy isn't configured, we have nothing to do.
|
||||
if (!this.IsConfigured) return;
|
||||
|
||||
logger.LogInfo($"Setting up Dependabot proxy at {this.Address}");
|
||||
|
||||
startInfo.EnvironmentVariables["HTTP_PROXY"] = this.Address;
|
||||
startInfo.EnvironmentVariables["HTTPS_PROXY"] = this.Address;
|
||||
startInfo.EnvironmentVariables["SSL_CERT_FILE"] = this.certFile?.FullName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,6 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
// Configure the proxy settings, if applicable.
|
||||
this.proxy.ApplyProxy(this.logger, startInfo);
|
||||
|
||||
this.logger.LogInfo(startInfo.EnvironmentVariables["HTTP_PROXY"] ?? "");
|
||||
this.logger.LogInfo(startInfo.EnvironmentVariables["HTTPS_PROXY"] ?? "");
|
||||
this.logger.LogInfo(startInfo.EnvironmentVariables["SSL_CERT_FILE"] ?? "");
|
||||
|
||||
return startInfo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user