chore(copilot): use GH_HOST for Copilot endpoints and token lookup#2090
chore(copilot): use GH_HOST for Copilot endpoints and token lookup#2090rmuir wants to merge 2 commits intoolimorris:mainfrom
Conversation
Update Copilot HTTP requests and token lookup to respect the `GH_HOST` env var, allowing use with GitHub Enterprise instances. Some networks block the `github.com` endpoints, so they won't work at all. Provide a way for the user to hit different endpoint other than `github.com` (e.g. mycorp.ghe.com) without patching the source code. The `GH_HOST` environment variable is the same one used to override this for `gh` cli: https://cli.github.com/manual/gh_help_environment
|
Maybe a cleaner solution would be to parse out of the oauth rather than looking for {"mycorp.ghe.com:Xy1.00deadbeef0":{"user":"my-user","oauth_token":"<nope>","githubAppId":"Xy1.00deadbeef0"}} |
|
This PR is stale because it has been open for 30 days with no activity. |
|
@olimorris Any chance this could be merged? My company just updated copilot support to use Enterprise, so I can't use CodeCompanion anymore without this PR |
|
Well, I don't think this patch is enough... testing it locally I can see that the way the plugin handles URLs is too coupled, as the URL is always fully formed with host + path. The "real" fix would be to separate this |
|
All - apologies for not getting to this sooner. @rmuir presume this is good to be merged? Aware this isn't enough for @AmadeusK525 but potentially still useful for other users. |
|
@olimorris I think it is no good for current |
|
Hey, I re-opened this in #2705, and it does work (I've been using it for a while) |
Update Copilot HTTP requests and token lookup to respect the
GH_HOSTenv var, allowing use with GitHub Enterprise instances.Some networks block the
github.comendpoints, so they won't work at all. Provide a way for the user to hit different endpoint other thangithub.com(e.g. mycorp.ghe.com) without patching the source code.The
GH_HOSTenvironment variable is the same one used to override this forghcli: https://cli.github.com/manual/gh_help_environmentNote: maybe this isn't the best solution, I'm not a lua guy... but I tested it in such a restrictive environment and it works.