fix forge api base url construction#141
Merged
Merged
Conversation
Add unit tests covering known domains, explicit forge types, configured forge types, and unknown-domain fallback behavior.
pigam
marked this pull request as draft
July 21, 2026 08:59
Contributor
Author
|
Further analysis : the api base url is a property of a forge.
_, owner, repoName, domain, err := resolve.Repo(flagRepo, flagForgeType)
^
# forge !Normal, as the I think a cleaner solution would be to add An opinion ? |
Contributor
|
Agreed, the API base URL belongs to the resolved forge. I’d use a small companion interface such as |
Add an optional APIBaseURLProvider interface and implement it for the built-in forge backends. Use the resolved forge in `forge api` to derive the API root, while preserving the legacy domain heuristic as a fallback for forge implementations that do not expose an API base URL. Add tests for backend-provided API URLs, legacy fallback behavior, and self-hosted GitLab domains configured with `type = gitlab`.
Contributor
Author
|
The last version should be cleaner.
|
pigam
marked this pull request as ready for review
July 23, 2026 06:43
andrew
approved these changes
Jul 23, 2026
This was referenced Jul 23, 2026
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.
Fix
forge apiAPI base URL selection for self-hosted forge instances.forge apipreviously selected the API root using domain-name substring checks, for example by looking forgitlabin the hostname. This breaks self-hosted instances whose domain does not include the expected forge-specific substring.Closes #140
Changes
apiBaseURL.--forge-typetype