feat(peering): admin enable/disable from the panel (#134) #135

Merged
Cordy merged 1 commit from feat/peering-enable into main 2026-08-07 01:20:54 +00:00
Owner

Closes #134.

Makes peering something an admin turns on and off from the running instance, instead of a deploy-time config decision.

Two-level gating, resolved. peering.statePath now defaults to /data/.cairn/peering.json (config.go), so the subsystem is always mounted — the admin panel, key issuance and peer registration work on every instance. The runtime peeringEnabled setting decides whether the transport actually answers.

Server. PeeringSendAPI gains an Enabled func() bool gate (nil = ungated, so existing tests are unchanged). send/peers/transfers return 503 when peering is off. main.go wires the existing peerOn closure (settingsStore.Get().PeeringEnabled). Because the send UI feature-probes GET /peering/peers, the 503 makes the send surface auto-hide until an admin turns peering on. New test: TestSendSurfaceUnavailableWhenPeeringOff.

UI. A labelled enable/disable switch at the top of the Instance-peering panel, bound to serverSettings.peeringEnabled. Toggling it re-PUTs the full settings object with the flag flipped — no new endpoint. i18n for all four locales; a quiet notice explaining what "off" means.

No new server endpoint; reuses GET/PUT /api/v1/settings. Green on the branch: gofmt/vet clean, full go test ./... pass, go build ./... clean, both JS blocks pass node --check.

Closes #134. Makes peering something an admin turns on and off from the running instance, instead of a deploy-time config decision. **Two-level gating, resolved.** `peering.statePath` now defaults to `/data/.cairn/peering.json` (config.go), so the subsystem is always *mounted* — the admin panel, key issuance and peer registration work on every instance. The runtime `peeringEnabled` setting decides whether the transport actually *answers*. **Server.** `PeeringSendAPI` gains an `Enabled func() bool` gate (nil = ungated, so existing tests are unchanged). `send`/`peers`/`transfers` return `503` when peering is off. `main.go` wires the existing `peerOn` closure (`settingsStore.Get().PeeringEnabled`). Because the send UI feature-probes `GET /peering/peers`, the 503 makes the send surface auto-hide until an admin turns peering on. New test: `TestSendSurfaceUnavailableWhenPeeringOff`. **UI.** A labelled enable/disable switch at the top of the Instance-peering panel, bound to `serverSettings.peeringEnabled`. Toggling it re-`PUT`s the full settings object with the flag flipped — no new endpoint. i18n for all four locales; a quiet notice explaining what "off" means. No new server endpoint; reuses `GET`/`PUT /api/v1/settings`. Green on the branch: gofmt/vet clean, full `go test ./...` pass, `go build ./...` clean, both JS blocks pass `node --check`.
feat(peering): admin enable/disable from the panel; default statePath; gate send surface (#134)
All checks were successful
ci / test-and-build (pull_request) Successful in 36s
a3bf2870e9
Cordy merged commit d23af042de into main 2026-08-07 01:20:54 +00:00
Cordy deleted branch feat/peering-enable 2026-08-07 01:20:58 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#135
No description provided.