Skip to content

Support github.localhost as a non-enterprise host#4523

Merged
mislav merged 5 commits intocli:trunkfrom
joshmgross:joshmgross/support-localhost
Oct 19, 2021
Merged

Support github.localhost as a non-enterprise host#4523
mislav merged 5 commits intocli:trunkfrom
joshmgross:joshmgross/support-localhost

Conversation

@joshmgross
Copy link
Contributor

This pull request adds support for using github.localhost as a non-enterprise host.

When developing GitHub locally, the dev environment isn't necessarily a GHES dev environment. Currently the CLI assumes all hosts outside of github.localhost are GHES instances, which causes issues when the dev environment expects API routes like https://api.github.localhost rather than the GHES format of https://github.localhost/api

To test this pull request, you'll need a local dev environment of GitHub. You can then set the GH_HOST environment variable to reach that local dev instance:

export GH_HOST="github.localhost"

Questions for reviewers

  1. Rather than specifying github.localhost explicitly, should we support some environment variable option to specify that GH_HOST shouldn't be treated as an enterprise host?

@joshmgross joshmgross requested a review from a team as a code owner October 14, 2021 21:45
@joshmgross joshmgross requested review from mislav and removed request for a team October 14, 2021 21:45
@cliAutomation
Copy link
Collaborator

Hi! Thanks for the pull request. Please ensure that this change is linked to an issue by mentioning an issue number in the description of the pull request. If this pull request would close the issue, please put the word 'Fixes' before the issue number somewhere in the pull request body. If this is a tiny change like fixing a typo, feel free to ignore this message.

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; this looks great!

Rather than specifying github.localhost explicitly, should we support some environment variable option to specify that GH_HOST shouldn't be treated as an enterprise host?

That's a good question and adding such a feature would definitely make the solution more generic—for example, you could then use GH_HOST to point to a GitHub.com instance hosted elsewhere on your network than github.localhost. But, I'm not sure if it's worth adding a specialized environment variable just for this. If most dotcom developers consistently use github.localhost, then the change as you've made it right now is good enough. 👍

Copy link
Contributor

@adonovan adonovan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for making this fix!

@mislav
Copy link
Contributor

mislav commented Oct 15, 2021

Note: I will be adding more changes to this PR to support gh auth login flow for github.localhost and to fix generated URLs (API, web, git clone) to have http:// instead of https:// for a local github instance.

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.

4 participants