Skip to content

Commit

Permalink
Support for GH_HOST env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
seachicken committed Nov 3, 2024
1 parent 211a4d0 commit c9be6f2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"os"
"regexp"
"slices"
"sort"
Expand Down Expand Up @@ -38,8 +39,13 @@ func GetRemote(ctx context.Context, connection shared.Connection) (shared.Remote
remotes := toRemotes(SplitLines(remoteNames))
if remote, err := getPrimaryRemote(remotes); err == nil {
hostname := remote.Hostname
if config, err := connection.GetSshConfig(ctx, hostname); err == nil {
remote.Hostname = normalizeHostname(findHostname(SplitLines(config), hostname))
ghHost := os.Getenv("GH_HOST")
if ghHost == "" {
if config, err := connection.GetSshConfig(ctx, hostname); err == nil {
remote.Hostname = normalizeHostname(findHostname(SplitLines(config), hostname))
}
} else {
remote.Hostname = ghHost
}
return remote, nil
} else {
Expand Down

0 comments on commit c9be6f2

Please sign in to comment.