GitTools / GitReleaseManager

Tool for creating and exporting releases for software applications hosted on GitHub
https://gittools.github.io/GitReleaseManager/docs/
MIT License
303 stars 39 forks source link

Support Custom / Default Proxy #63

Open ckpearson opened 8 years ago

ckpearson commented 8 years ago

I'm currently trying to get this working in our TeamCity environment, which unfortunately due to all the usual corporate nonsense is in a proxied setup.

Trying to run this I'm getting "System.Net.WebException: ... Proxy Authentication Required".

There are proxy details configured in the internet options (default IE settings) for the machine and these are correct.

I've encountered this issue before when working with OctoKit myself, and a fix was to initialise the github client with a declaration to use the default proxy:

var webProxy = new WebProxy("proxyAddress", true);
client = new GitHubClient(new Connection(new ProductHeaderValue(ProductName), new HttpClientAdapter(webProxy)))

I've even tried adding a `GitReleaseManager.exe.config" file in the chocolatey directory where the exe is placed, with the following content:

<configuration>
    <system.net>
        <defaultProxy enabled="true">
            <proxy usesystemdefault="True"/>
        </defaultProxy>
    </system.net>
</configuration>

This isn't having the desired effect though.

CHAT ROOM I couldn't access this due to corporate policy (yaaaay)

ckpearson commented 8 years ago

Bit of digging led to BaseGitHubSubOptions.cs where:

public GitHubClient CreateGitHubClient()
  {
    var credentials = new Credentials(this.UserName, this.Password);
    var github = new GitHubClient(new ProductHeaderValue("GitReleaseManager")) { Credentials = credentials };
    return github;
  }

So it does appear as though this doesn't pay attention to proxy settings.

gep13 commented 8 years ago

@ckpearson thanks for reaching out!

Yeah, a proxy is not something that I have had to worry about, and therefore not included in the current GitReleaseManager.

Are you in a position to put together a PR to implement this? If so, I would be happy to get this pulled in.

Thanks!

ckpearson commented 8 years ago

@gep13 sure, I'll get something together for you!