mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +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;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Semmle.Util;
|
using Semmle.Util;
|
||||||
|
using Semmle.Util.Logging;
|
||||||
|
|
||||||
namespace Semmle.Extraction.CSharp.DependencyFetching
|
namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||||
{
|
{
|
||||||
@@ -49,5 +51,17 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
|||||||
using var writer = this.certFile.CreateText();
|
using var writer = this.certFile.CreateText();
|
||||||
writer.Write(cert);
|
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.
|
// Configure the proxy settings, if applicable.
|
||||||
this.proxy.ApplyProxy(this.logger, startInfo);
|
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;
|
return startInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user