Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
benjlevesque committed Mar 17, 2023
1 parent c5ac6fe commit f91f1db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/config/config.go
Expand Up @@ -140,8 +140,8 @@ func (c *AuthConfig) Token(hostname string) (string, string) {
return token, source
}

// HasEnvOrConfigToken checks whether the current env or config contains a token.
func (c *AuthConfig) HasEnvOrConfigToken() bool {
// HasEnvToken checks whether the current env or config contains a token
func (c *AuthConfig) HasEnvToken() bool {
// This will check if there are any environment variable
// authentication tokens set for enterprise hosts.
// Any non-github.com hostname is fine here
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/factory/remote_resolver.go
Expand Up @@ -84,7 +84,7 @@ func (rr *remoteResolver) Resolver() func() (context.Remotes, error) {
if len(cachedRemotes) == 0 {
if isHostEnv(src) {
return nil, fmt.Errorf("none of the git remotes configured for this repository correspond to the %s environment variable. Try adding a matching remote or unsetting the variable.", src)
} else if cfg.Authentication().HasEnvOrConfigToken() {
} else if cfg.Authentication().HasEnvToken() {
return nil, errors.New("set the GH_HOST environment variable to specify which GitHub host to use")
}
return nil, errors.New("none of the git remotes configured for this repository point to a known GitHub host. To tell gh about a new GitHub host, please use `gh auth login`")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmdutil/auth_check.go
Expand Up @@ -14,7 +14,7 @@ func DisableAuthCheck(cmd *cobra.Command) {
}

func CheckAuth(cfg config.Config) bool {
if cfg.Authentication().HasEnvOrConfigToken() {
if cfg.Authentication().HasEnvToken() {
return true
}

Expand Down

0 comments on commit f91f1db

Please sign in to comment.