lanternd: support explicit staging environment for desktop services - #577
lanternd: support explicit staging environment for desktop services#577atavism wants to merge 7 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe daemon now supports validated ChangesDaemon environment selection
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant RunCommand
participant serviceConfig
participant ServiceManager
participant runDaemon
participant Backend
RunCommand->>serviceConfig: Read paths, log level, and environment
serviceConfig->>ServiceManager: Persist daemon arguments
ServiceManager->>runDaemon: Start with selected environment
runDaemon->>Backend: Initialize with environment-specific endpoints and authentication
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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.
Summary by CodeRabbit
New Features
Bug Fixes
Tests