feat: improve base URL configuration - #532
Open
adityakrmishra wants to merge 2 commits into
Open
Conversation
Generate changelog in
|
jamestoyer
reviewed
Jul 23, 2026
jamestoyer
left a comment
Contributor
There was a problem hiding this comment.
I understand the general principal here but this is actually a breaking change of sorts.
This change goes from allowing people to specify some URLs to having all URLs populated. There are times when you don't want to use the v4 API or have a web URL making setting these is optional but with this PR you are forcing that all URLs are set. If there are downstream users reliant on failures when a URL is not set then this may cause unexpected behaviour in their apps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #5
Hi team,
This PR simplifies the client configuration by allowing users to provide a single
BaseURLfrom which the Web, APIv3, and APIv4 URLs are automatically derived, as outlined in the original issue.Key Changes:
URLsstruct andParseURLslogic (urls.go) that intelligently routes between publicgithub.comendpoints and GitHub Enterprise endpoints.Configto supportBaseURLvia YAML/JSON/Env, but existing explicit fields (WebURL,V3APIURL,V4APIURL) are preserved and take precedence if defined.NewDefaultCachingClientCreatorto utilize the newconfig.GetURLs()method.urls_test.go) covering public GitHub, Enterprise URLs (with and without schemes/stray paths), and the fallback precedence logic.The code adheres to the existing project style, and all tests pass cleanly. Let me know if you'd like any adjustments to the enterprise URL parsing logic!