- Notifications
You must be signed in to change notification settings - Fork1.2k
Open
Description
Right now we take a GHES hostname and use same domain, but actually subdomain isolation can be optionally enabled, and then for examplehttps://{domain}/raw
becomeshttps://raw.{domain}
funcnewGHESHost(hostnamestring) (apiHost,error) {u,err:=url.Parse(hostname)iferr!=nil {returnapiHost{},fmt.Errorf("failed to parse GHES URL: %w",err)}restURL,err:=url.Parse(fmt.Sprintf("%s://%s/api/v3/",u.Scheme,u.Hostname()))iferr!=nil {returnapiHost{},fmt.Errorf("failed to parse GHES REST URL: %w",err)}gqlURL,err:=url.Parse(fmt.Sprintf("%s://%s/api/graphql",u.Scheme,u.Hostname()))iferr!=nil {returnapiHost{},fmt.Errorf("failed to parse GHES GraphQL URL: %w",err)}uploadURL,err:=url.Parse(fmt.Sprintf("%s://%s/api/uploads/",u.Scheme,u.Hostname()))iferr!=nil {returnapiHost{},fmt.Errorf("failed to parse GHES Upload URL: %w",err)}rawURL,err:=url.Parse(fmt.Sprintf("%s://%s/raw/",u.Scheme,u.Hostname()))iferr!=nil {returnapiHost{},fmt.Errorf("failed to parse GHES Raw URL: %w",err)}returnapiHost{baseRESTURL:restURL,graphqlURL:gqlURL,uploadURL:uploadURL,rawURL:rawURL,},nil}