Make Debian upstream repository configurable. - #229
Conversation
|
The lint failed with: is this the preferred way ? (in the same PR ? in the same commit or a different commit ?) |
9eeda4c to
703c59e
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The env override refactor misplaces the LoadFromEnv GoDoc comment and the new upstream configurability path should be exercised by tests within the changed regions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR adds configuration support for overriding the Debian/APT handler’s upstream base URL (e.g., pointing at Ubuntu archives) and wires that through server startup and environment-variable loading.
Changes:
- Extend
NewDebianHandlerto accept a configurable upstream URL (defaulting to the existing Debian upstream when unset). - Add
Upstream.Debianto config defaults andPROXY_UPSTREAM_DEBIANenvironment override support. - Update affected tests and call sites to use the new Debian handler constructor signature.
File summaries
| File | Description |
|---|---|
| internal/server/server.go | Passes configured Debian upstream into the Debian handler at server start. |
| internal/handler/debian.go | Adds an upstream URL parameter with defaulting + trailing-slash normalization. |
| internal/handler/download_test.go | Updates Debian handler construction in download cache-miss test. |
| internal/handler/notfound_ecosystems_test.go | Updates Debian handler construction in upstream-not-found test table. |
| internal/handler/debian_test.go | Updates Debian handler construction in routes test. |
| internal/config/config.go | Adds Upstream.Debian, default value, env override, and refactors env parsing helpers. |
| internal/config/config_test.go | Verifies default and env override behavior for Upstream.Debian. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 3
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
The One small thing the refactor introduced: the The third Copilot suggestion on |
Avoid triggering the linter about the cyclomatic complexity of the LoadFromEnv function in later changes by refactoring it to use setEnvString/setEnvBool helpers. No functional change, just collapse ~29 repetitive if-blocks into single-line calls to two small helpers.
Support overriding the Debian handler's upstream (e.g. Ubuntu archives) via PROXY_UPSTREAM_DEBIAN or upstream.debian in the config file. Tested with PROXY_UPSTREAM_DEBIAN=http://archive.ubuntu.com/ubuntu to get Ubuntu Resolute packages.
703c59e to
2777b06
Compare
The updated version should now fix the comment/doc |
Support overriding the Debian handler's upstream (e.g. Ubuntu archives)
Tested with
PROXY_UPSTREAM_DEBIAN=http://archive.ubuntu.com/ubuntuto get Ubuntu Resolute packages.