Skip to content

lanternd: support explicit staging environment for desktop services - #577

Open
atavism wants to merge 4 commits into
mainfrom
atavism/issue-3723
Open

lanternd: support explicit staging environment for desktop services#577
atavism wants to merge 4 commits into
mainfrom
atavism/issue-3723

Conversation

@atavism

@atavism atavism commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings July 24, 2026 16:19
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@atavism, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c9b54e3f-14ba-42da-b3d8-d5d678174d44

📥 Commits

Reviewing files that changed from the base of the PR and between 076d997 and 2ef18c7.

📒 Files selected for processing (5)
  • cmd/lanternd/lanternd.go
  • cmd/lanternd/lanternd_darwin.go
  • cmd/lanternd/lanternd_linux.go
  • cmd/lanternd/lanternd_test.go
  • cmd/lanternd/lanternd_windows.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch atavism/issue-3723

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --environment flag (validated) to lanternd run and lanternd 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.

Comment thread cmd/lanternd/lanternd.go
Comment on lines +400 to +410
// 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),
},
}
}
Comment thread cmd/lanternd/lanternd.go
Comment on lines +50 to +51
// UnmarshalText validates the environment while go-arg parses the command line.
func (e *daemonEnvironment) UnmarshalText(text []byte) error {
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.

2 participants