Skip to content

use proxy for omnifunc when configured in .gitconfig or .git/config#52

Open
shadowwa wants to merge 1 commit intoshumphrey:masterfrom
shadowwa:proxy-support
Open

use proxy for omnifunc when configured in .gitconfig or .git/config#52
shadowwa wants to merge 1 commit intoshumphrey:masterfrom
shadowwa:proxy-support

Conversation

@shadowwa
Copy link
Copy Markdown

When using a gitlab instance behind a proxy, I need to configure the proxy in ~/.gitconfig or .git/config file.

[http "https://gitlab-url.private"]
    proxy = socks5h://proxy-url:8082
# or
[http]
    proxy = socks5h://proxy-url:8082

In fugitive-gitlab.vim, curl requests are not using this proxy hence the omnifunc does not works.

With this commit, if a proxy is configured in git config files, it will by used.

@shumphrey
Copy link
Copy Markdown
Owner

hmm, I would have expected that config to be part of your ~/.curlrc

@shumphrey
Copy link
Copy Markdown
Owner

I haven't fully thought this through, but I think it used to be common for the git config of gitlab to be different to the api/http stuff.
I'm a bit concerned this could break other use cases.
curl supports both the HTTP_PROXY environment variables and the ~/.curlrc config file.
Is there something you can do with those for your use case?

@shumphrey
Copy link
Copy Markdown
Owner

I had a quick scan of rhubarb to see if it supports doing anything with gitconfig http proxy and it doesn't appear to.

@shadowwa
Copy link
Copy Markdown
Author

I haven't fully thought this through, but I think it used to be common for the git config of gitlab to be different to the api/http stuff. I'm a bit concerned this could break other use cases.

Do you mean when git use

[remote "origin"]
  url = git@my-ssh.gitlab.private

and the gitlab api is accessible via https://gitlab-url.private ?
I did not thought about this case. A quick test show that it is working but means having a proxy conf in .gitconfig only to be used by fugitive-gitlab and not git.
It maybe cleaner to have a new option like

let g:gitlab_proxies = {'gitlab-url.private': 'socks5h://proxy-url:8082'}

curl supports both the HTTP_PROXY environment variables and the ~/.curlrc config file. Is there something you can do with those for your use case?

It was my first idea but unfortunately, proxies can only be set global from HTTP_PROXY environment variables or in ~/.curlrc not per host basis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants