Skip to content

Ensure pkgproxy.yaml is properly shipped and loaded from image#130

Merged
ganto merged 6 commits intomainfrom
feature/inline-config
Apr 18, 2026
Merged

Ensure pkgproxy.yaml is properly shipped and loaded from image#130
ganto merged 6 commits intomainfrom
feature/inline-config

Conversation

@ganto
Copy link
Copy Markdown
Owner

@ganto ganto commented Apr 18, 2026

No description provided.

ganto and others added 2 commits April 18, 2026 23:20
When invoked with no arguments (e.g. `podman run ghcr.io/ganto/pkgproxy`),
the binary now dispatches the `serve` subcommand automatically. The config
file search order is extended to fall back to `$KO_DATA_PATH/pkgproxy.yaml`
when `./pkgproxy.yaml` is absent, enabling the published container image to
start out of the box without any explicit flags or bind mounts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ganto ganto requested a review from Copilot April 18, 2026 22:36
@ganto ganto added the bug Something isn't working label Apr 18, 2026
@ganto ganto added the go Pull requests that update Go code label Apr 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the CLI so the container image can start a server by default and discover the bundled pkgproxy.yaml via $KO_DATA_PATH, with accompanying specs/tests and documentation updates.

Changes:

  • Add a pre-Cobra argv shim that injects serve when invoked with no user args.
  • Extend config discovery to fall back to $KO_DATA_PATH/pkgproxy.yaml when no explicit config path is provided.
  • Add unit tests and update README/CHANGELOG plus openspec design/spec artifacts.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
cmd/root.go Adds injectServeDefault() and resolveConfigPath(); updates initConfig() precedence logic.
cmd/root_test.go Unit tests for the argv shim behavior.
cmd/config_test.go Unit tests for resolveConfigPath() discovery order.
README.md Simplifies container run examples by removing explicit --config usage.
CHANGELOG.md Adds an Unreleased entry describing the new container behavior.
openspec/changes/container-default-config/* Adds proposal/design/specs/tasks and openspec metadata documenting the change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/config_test.go
Comment thread openspec/changes/container-default-config/design.md Outdated
Comment thread openspec/changes/container-default-config/proposal.md Outdated
Comment thread openspec/changes/container-default-config/tasks.md Outdated
Comment thread README.md
Comment on lines 15 to +23
Run the application via a container engine (e.g. [Podman](https://podman.io/)):

- Using the default repository configuration:
```shell
podman run --rm -p 8080:8080 --volume ./cache:/ko-app/cache:z ghcr.io/ganto/pkgproxy serve --host 0.0.0.0 --config /var/run/ko/pkgproxy.yaml
podman run --rm -p 8080:8080 --volume ./cache:/ko-app/cache:z ghcr.io/ganto/pkgproxy serve --host 0.0.0.0
```
- Mounting your own local `pkgproxy.yaml`:

To use a custom `pkgproxy.yaml`, bind-mount it into the container:
```shell
podman run --rm -p 8080:8080 --volume ./cache:/ko-app/cache:z --volume ./pkgproxy.yaml:/ko-app/pkgproxy.yaml ghcr.io/ganto/pkgproxy serve --host 0.0.0.0 --config /ko-app/pkgproxy.yaml
podman run --rm -p 8080:8080 --volume ./cache:/ko-app/cache:z --volume ./pkgproxy.yaml:/ko-app/pkgproxy.yaml ghcr.io/ganto/pkgproxy serve --host 0.0.0.0
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container examples still invoke serve --host 0.0.0.0 explicitly, so the README doesn't demonstrate the new "default subcommand" behavior described elsewhere in this change set (and in the PR title). If the intent is that podman run ... ghcr.io/ganto/pkgproxy works without args, the docs and/or serve defaults should be updated accordingly; otherwise, consider adding a brief note explaining why serve is still shown (e.g., because --host is a serve flag and the default bind address is localhost).

Copilot uses AI. Check for mistakes.
Comment thread cmd/root.go Outdated
Comment thread cmd/root.go
Comment thread cmd/root.go
ganto and others added 4 commits April 19, 2026 00:54
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ment

serve defaults to localhost, which is unreachable via container port
mapping. Update the proposal's goal invocation and task 3.1 description
to match the README; note that changing the listen default is out of
scope.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Change resolveConfigPath to return (string, error): propagate
  non-ErrNotExist stat errors instead of silently falling through
- Add Mode().IsRegular() check so a directory named pkgproxy.yaml
  falls through to the KO_DATA_PATH fallback
- Use filepath.Join for the ko fallback path construction
- Add TestInitConfig covering all three precedence scenarios:
  explicit --config bypasses env var and lookup; PKGPROXY_CONFIG
  bypasses ordered lookup; ordered lookup runs when both unset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ganto ganto merged commit 93a8082 into main Apr 18, 2026
21 checks passed
@ganto ganto deleted the feature/inline-config branch April 18, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants