Skip to content

Commit

Permalink
Merge pull request #292 from Microsoft/users/ersciple/m102proxy
Browse files Browse the repository at this point in the history
Web proxy variable and default creds.
  • Loading branch information
ericsciple authored Jun 13, 2016
2 parents 8a08dee + 951c593 commit 07ac961
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Microsoft.VisualStudio.Services.Agent/WebProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ public static void ApplyProxySettings()
{
return;
}
_proxySettingsApplied = true;
var proxyFilePath = IOUtil.GetProxyConfigFilePath();
bool proxyConfigured = (new FileInfo(proxyFilePath)).Exists;
if (!proxyConfigured)

string proxy = Environment.GetEnvironmentVariable("VSTS_HTTP_PROXY");
if (!string.IsNullOrEmpty(proxy))
{
return;
VssHttpMessageHandler.DefaultWebProxy = new WebProxy(new Uri(proxy))
{
Credentials = CredentialCache.DefaultNetworkCredentials
};
}
string proxyURI = File.ReadAllText(proxyFilePath);
VssHttpMessageHandler.DefaultWebProxy = new WebProxy(new Uri(proxyURI));

_proxySettingsApplied = true;
}
}
}
1 change: 1 addition & 0 deletions src/Misc/layoutroot/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ varCheckList=(
'GRADLE_HOME'
'NVM_BIN'
'NVM_PATH'
'VSTS_HTTP_PROXY'
)

envContents=""
Expand Down

0 comments on commit 07ac961

Please sign in to comment.