Skip to content

4. feat: remote proxy handler for desktop app#91

Open
Adam-D-Lewis wants to merge 1 commit intoshared-service-layerfrom
remote-proxy-handler-v2
Open

4. feat: remote proxy handler for desktop app#91
Adam-D-Lewis wants to merge 1 commit intoshared-service-layerfrom
remote-proxy-handler-v2

Conversation

@Adam-D-Lewis
Copy link
Member

Summary

  • Add RemoteHandler that proxies frontend requests to a remote Nebi team server in local/desktop mode
  • Uses existing cliclient package (typed methods) for all upstream communication
  • Stores server URL and credentials in the local SQLite DB via store.Config/store.Credentials
  • Routes registered only when localMode == true under /api/v1/remote/*

Endpoints (13 total)

  • POST /connect — authenticate with remote server, store token
  • GET /server — connection status
  • DELETE /server — disconnect, clear credentials
  • GET/POST/DELETE /workspaces[/:id] — proxy CRUD
  • GET /workspaces/:id/versions — proxy version listing
  • GET /workspaces/:id/tags — proxy tag listing
  • GET /workspaces/:id/pixi-toml — proxy pixi.toml (JSON wrapped)
  • GET /workspaces/:id/versions/:version/pixi-toml — proxy (JSON wrapped)
  • GET /workspaces/:id/versions/:version/pixi-lock — proxy (JSON wrapped)
  • POST /workspaces/:id/push — proxy version push

Design decisions

  • 503 (not 400) for "not connected" errors — distinguishes client errors from config state issues
  • JSON wrapping for pixi.toml/lock endpoints — upstream returns plain text, proxy wraps in {"content": "..."} for uniform frontend consumption
  • GORM error checks on all DB writes in connect/disconnect
  • Typed cliclient methods used where available (ListWorkspaces, GetWorkspace, etc.)

Test plan

  • go vet ./...
  • 6 unit tests: server status, connect/disconnect, mock remote, not-connected proxy
  • go test ./internal/api/handlers/... ./internal/service/... ./internal/store/...
  • Frontend builds cleanly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant