Sync host opencode auth into guest work disks

Refresh guest opencode auth from the host at VM start so guest opencode can reuse the local login without baking secrets into managed images.

Reuse the existing work-disk preparation path to copy ~/.local/share/opencode/auth.json into /root/.local/share/opencode/auth.json with mode 0600, and warn and skip when the host file is missing or unreadable so any existing guest auth stays in place.

Add daemon coverage for copy, replacement, and warn-and-skip cases, document the restart behavior in the README, and validate with go test ./... plus make build. Existing VMs pick the new auth up on their next restart.
This commit is contained in:
Thales Maciel 2026-03-21 22:36:13 -03:00
parent 786d235f7f
commit 8bcc767824
No known key found for this signature in database
GPG key ID: 33112E6833C34679
4 changed files with 256 additions and 1 deletions

View file

@ -141,6 +141,8 @@ Provisioned images include:
- `opencode`
- a default guest `opencode` service on `0.0.0.0:4096`
If host `~/.local/share/opencode/auth.json` exists, `banger` syncs it into the guest at `/root/.local/share/opencode/auth.json` on VM start. Changes on the host take effect after the VM is restarted.
From the host:
```bash