Skip to content

feat(repository): support self-hosted servers via the server attribute - #148

Open
roxblnfk wants to merge 4 commits into
1.xfrom
feat/repository-server
Open

roxblnfk wants to merge 4 commits into
1.xfrom
feat/repository-server

Conversation

@roxblnfk

Copy link
Copy Markdown
Member

What was changed

  • <repository server="..."> points a repository at GitHub Enterprise Server, a self-hosted GitLab or a local fake API: [scheme://]host[:port], https by default; the API is {server}/api/v3 (GitHub) / {server}/api/v4 (GitLab). Without it nothing changes.
  • Tokens are declared per server in DLOAD_TOKEN_<HOST> (e.g. DLOAD_TOKEN_GHE_EXAMPLE_COM). DLOAD_TOKEN_GITHUB_COM / DLOAD_TOKEN_GITLAB_COM win over GITHUB_TOKEN / GITLAB_TOKEN, which never leave the public hosts. A token goes only to the exact scheme, host and port of its server, and over plain http only to loopback. The GitLab client used to attach its token to every request; it now has the same host check.
  • The version registry keys a self-hosted repository by its server too (github@ghe.example.com/owner/repo); paths and records of the public hosts are unchanged, so existing registries stay valid. Repository::getId() gives the downloader that key.

Why?

Design agreed in #143 (comment). Unblocks roadrunner-php/cli#49, whose rr get acceptance tests run against a local fake API.

Checklist

fix(repository): send the GitLab token only to the GitLab server
feat(repository): read tokens from `DLOAD_TOKEN_<HOST>`, ahead of `GITHUB_TOKEN` and `GITLAB_TOKEN`
docs: describe self-hosted servers and per-server tokens
docs(skill): cover the `server` attribute

The token variable is derived from the server address so that only the user's environment, never a config file, decides which host receives a token; `GITHUB_TOKEN` and `GITLAB_TOKEN` stay with the public hosts, and plain http carries a token only to loopback.

Closes #143

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added enhancement New feature or request tests labels Oct 10, 2026
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.40000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Module/Repository/Internal/Server.php 95.55% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/Bootstrap.php 100.00% <100.00%> (ø)
src/Module/Config/Schema/Embed/Repository.php 100.00% <100.00%> (ø)
src/Module/Downloader/Downloader.php 100.00% <100.00%> (ø)
...c/Module/Registry/Internal/FileRegistryStorage.php 100.00% <100.00%> (ø)
src/Module/Registry/Record/RepositoryRecord.php 100.00% <100.00%> (ø)
src/Module/Registry/RepositoryId.php 100.00% <100.00%> (ø)
...c/Module/Repository/Internal/GitHub/Api/Client.php 100.00% <100.00%> (ø)
...pository/Internal/GitHub/Api/ResponseValidator.php 100.00% <100.00%> (ø)
src/Module/Repository/Internal/GitHub/Factory.php 95.83% <100.00%> (ø)
...le/Repository/Internal/GitHub/GitHubRepository.php 97.36% <100.00%> (ø)
... and 6 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

A Mockery URI returns null from getScheme() under psr/http-message 1.1,
which broke the lowest-deps jobs once a token makes the client check the host.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support a custom host for repositories (GitHub Enterprise, self-hosted GitLab)

1 participant