This is done by inspecting the current hostname to determine if tenancy is enabled. The attestation commands also accepts a --hostname parameter, that is used to pick the current host, similar to how the GH_HOST variable can be used. Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
18 lines
534 B
Go
18 lines
534 B
Go
package auth
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/cli/cli/v2/internal/ghinstance"
|
|
)
|
|
|
|
var ErrUnsupportedHost = errors.New("An unsupported host was detected. Note that gh attestation does not currently support GHES")
|
|
|
|
func IsHostSupported(host string) error {
|
|
// Note that this check is slightly redundant as Tenancy should not be considered Enterprise
|
|
// but the ghinstance package has not been updated to reflect this yet.
|
|
if ghinstance.IsEnterprise(host) && !ghinstance.IsTenancy(host) {
|
|
return ErrUnsupportedHost
|
|
}
|
|
return nil
|
|
}
|