Replace `api_host` with `ssh_host`

Problem to solve

I want to be able to use glab with a self-managed GitLab instance and different hostnames for http(s) and ssh, and still be able to use both, ssh and https. Some of this has already been discussed in #1073 (closed).

At the moment, I would need to login 2 times, one time using the actual hostname and one time using the ssh one, overriding the api_host. This is not only redundant, but also breaks the Web login method, as it would try to login using SSH host for authentication.

My general assumptions are as follows:

  • the url used for cloning via http(s) is always the same as the one used for the api
    • the same applies to the protocol used (http/https)
    • (this was even the case when it was introduced in !598 (merged))
    • => there is no use in overriding the api host!
  • detecting the proper gitlab host when invoked from an already cloned repository is the only need to know about the ssh hostname

Proposal

Simplify the configuration by removing api_host, imho it is confusing and unnecessary, and replace it with an optional ssh_host option.

Further details

I am aware this would be a breaking change, but imo it would reduce some complexity. I am willing to contribute a MR, if you agreed to the proposed change.

Assignee Loading
Time tracking Loading