lanternd: support explicit staging environment for desktop services - #577
lanternd: support explicit staging environment for desktop services#577atavism wants to merge 4 commits into
Conversation
|
Warning Review limit reached
Next review available in: 15 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds an explicit prod|staging environment selection to lanternd so desktop installs (systemd/launchd/Windows service) can reliably run against staging backend services, and persists that selection in the service command line.
Changes:
- Add
--environmentflag (validated) tolanternd runandlanternd install, and propagate it into daemon startup options. - Persist the selected environment in system service definitions across Windows/systemd/launchd.
- Add tests covering argument parsing, persistence, and staging endpoint selection.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/lanternd/lanternd.go | Adds environment parsing/validation, service arg persistence helpers, and threads environment into backend options/logging. |
| cmd/lanternd/lanternd_windows.go | Persists --environment into the Windows service configuration and parses it back from the service ImagePath. |
| cmd/lanternd/lanternd_test.go | Adds tests for environment flag validation, service arg round-tripping, and staging endpoint selection. |
| cmd/lanternd/lanternd_linux.go | Extends the systemd unit template and install path to include --environment. |
| cmd/lanternd/lanternd_darwin.go | Extends the launchd plist template and install path to include --environment. |
Comments suppressed due to low confidence (2)
cmd/lanternd/lanternd.go:61
- The new doc comment above parseDaemonEnvironment restates what the function already makes clear from its name and implementation. To match AGENTS.md comment guidance, consider removing it unless there's a surprising invariant or rationale to document.
// parseDaemonEnvironment keeps lanternd from silently accepting an unknown environment.
func parseDaemonEnvironment(value string) (daemonEnvironment, error) {
cmd/lanternd/lanternd.go:413
- The doc comment above daemonBackendURLs restates the function name/signature rather than capturing a non-obvious contract. Consider removing it to keep comment noise low (per AGENTS.md).
// daemonBackendURLs returns the endpoints that the backend will use for the selected environment.
func daemonBackendURLs(environment daemonEnvironment) (authURL, proServerURL string) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // daemonBackendOptions passes the selected daemon environment through to the backend. | ||
| func daemonBackendOptions(dataPath, logPath, logLevel string, environment daemonEnvironment) backend.Options { | ||
| return backend.Options{ | ||
| DataDir: dataPath, | ||
| LogDir: logPath, | ||
| LogLevel: logLevel, | ||
| }) | ||
| EnvOverrides: map[string]string{ | ||
| commonenv.ENV.String(): string(environment), | ||
| }, | ||
| } | ||
| } |
| // UnmarshalText validates the environment while go-arg parses the command line. | ||
| func (e *daemonEnvironment) UnmarshalText(text []byte) error { |
Add validated prod|staging environment selection to lanternd run and install, persist it in the Windows service command, and expose the active environment. This lets installed Lantern payment tests reliably use staging services.