Skip to content

Add web-based service controls for restart and shutdown#41

Merged
DeanJ87 merged 2 commits into
mainfrom
feat/web-service-control
May 3, 2026
Merged

Add web-based service controls for restart and shutdown#41
DeanJ87 merged 2 commits into
mainfrom
feat/web-service-control

Conversation

@DeanJ87

@DeanJ87 DeanJ87 commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds POST /api/service/restart and POST /api/service/stop endpoints wired into the process lifecycle.
  • Restart exits with code 1 so service managers configured for restart-on-failure (Windows Service recovery options, NSSM AppExit policy, systemd Restart=on-failure) restart the process automatically; stop exits cleanly with code 0 and stays stopped.
  • Dashboard gains Restart and Stop buttons with JavaScript confirmation dialogs, a network-reachability warning when bound to a non-loopback address, and a plain-language note that stopping disables N.I.N.A./Alpaca safety integration until the service is restarted.
  • GET requests to the control paths fall through to the Dashboard catch-all and never trigger service actions — no plain link can accidentally trigger a stop or restart.
  • README documents the web controls, restart semantics, and the honest caveat that automatic restart depends on service manager configuration.

Validation

  • go test ./internal/web
  • go test ./...
  • go vet ./...

Closes #20

DeanJ87 added 2 commits May 4, 2026 00:10
Adds POST /api/service/restart and POST /api/service/stop endpoints wired
into the process lifecycle. Restart exits with code 1 so service managers
configured for restart-on-failure (Windows Service recovery, NSSM, systemd)
will restart automatically; stop exits cleanly with code 0.

Dashboard gains Restart/Stop buttons with JS confirmation dialogs,
a network-reachability warning when bound to 0.0.0.0, and a plain-language
note that stopping disables N.I.N.A./Alpaca safety integration.

GET requests to these paths fall through to the Dashboard catch-all and
never trigger service actions.

Closes #20
gosec requires #nosec G104 annotations; //nolint:errcheck alone does not
suppress the gosec scanner. Assign encoder and svc.Stop return values to _
and add the required suppression directive with a rationale comment.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@DeanJ87
DeanJ87 merged commit 88e9769 into main May 3, 2026
8 checks passed
@DeanJ87
DeanJ87 deleted the feat/web-service-control branch May 3, 2026 23:29
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.

Add web-based service controls for status, restart, and shutdown

2 participants