Skip to content

Commit c5c1260

Browse files
committed
C#: Set environment variables for proxy for calls to dotnet
1 parent b1828a8 commit c5c1260

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
2+
using System.Diagnostics;
23
using System.IO;
34
using Semmle.Util;
5+
using Semmle.Util.Logging;
46

57
namespace 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
}

0 commit comments

Comments
 (0)