You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, users have to specify the base URL three times in configuration:
The web URL, used for the OAuth login flow
The v3 API URL
The v4 API URL
It seems like we should be able to compute all of these given a single base URL, as long as we assume that github.com works in a known consistent way (most other client libraries seem to assume this.) Something like:
If if the base URL host is github.com, use api.github.com and api.github.com/graphql
Otherwise, assume an enterprise installation and use baseURL/api/v3 and baseURL/api/v4/graphql
The place where this would break is if someone is running a named proxy for github.com (i.e. not using the native proxy support in http.Client) or if someone put a proxy in front of their enterprise install to mess with the URLs. I don't think it's worth support either of those cases.
Maybe something like this:
typeURLsstruct {
Web*url.URLAPIv3*url.URLAPIv4*url.URL
}
funcNewURLs(baseURLstring) (*URLs, error) {
// parse baseURL, set others based on if it contains github.com or not
}
Then ClientCreator could take one of these objects and BaseHandler could expose one for use in other places if needed.
The text was updated successfully, but these errors were encountered:
// originally suggested by @bluekeyes
Currently, users have to specify the base URL three times in configuration:
It seems like we should be able to compute all of these given a single base URL, as long as we assume that
github.com
works in a known consistent way (most other client libraries seem to assume this.) Something like:github.com
, useapi.github.com
andapi.github.com/graphql
baseURL/api/v3
andbaseURL/api/v4/graphql
The place where this would break is if someone is running a named proxy for github.com (i.e. not using the native proxy support in
http.Client
) or if someone put a proxy in front of their enterprise install to mess with the URLs. I don't think it's worth support either of those cases.Maybe something like this:
Then
ClientCreator
could take one of these objects andBaseHandler
could expose one for use in other places if needed.The text was updated successfully, but these errors were encountered: