Skip to content

Commit

Permalink
C#: Set environment variables for proxy for calls to dotnet
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg committed Nov 19, 2024
1 parent b1828a8 commit c5c1260
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Diagnostics;
using System.IO;
using Semmle.Util;
using Semmle.Util.Logging;

namespace Semmle.Extraction.CSharp.DependencyFetching
{
Expand Down Expand Up @@ -49,5 +51,17 @@ internal DependabotProxy(TemporaryDirectory tempWorkingDirectory)
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;
}
}
}

0 comments on commit c5c1260

Please sign in to comment.