Skip to content

fix: Read hostname from config.yml

James Liu requested to merge jliu-fix-host-config into main

Description

Modifies the initialisation logic so that custom GitLab hostnames are properly read from config.yml files, as well as the environment variables. Prior to this change, configuring glab to use an alternate hostname via glab config --global set gitlab_uri <hostname> had no effect.

Related Issues

Resolves #1046 (closed) (partially)

How has this been tested?

  1. Build this branch from source:
❯ git checkout jliu-fix-host-config
❯ make
  1. Configure glab for a self-hosted GitLab instance:
❯ bin/glab config --global set gitlab_uri https://gitlab.gnome.org

❯ bin/glab auth login
? What GitLab instance do you want to log into? gitlab.gnome.org
- Logging into gitlab.gnome.org

Tip: you can generate a Personal Access Token here https://gitlab.gnome.org/-/profile/personal_access_tokens
The minimum required scopes are 'api' and 'write_repository'.
? Paste your authentication token: ********************
? Choose default git protocol HTTPS
? Authenticate Git with your GitLab credentials? No
- glab config set -h gitlab.gnome.org git_protocol https
✓ Configured git protocol
- glab config set -h gitlab.gnome.org api_protocol https
✓ Configured API protocol
✓ Logged in as disposedtrolley
  1. Clone a public test repo from the self-hosted GitLab instance:
❯ bin/glab repo clone disposedtrolley/cli-testing
Cloning into 'cli-testing'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
Edited by James Liu

Merge request reports