-
-
Notifications
You must be signed in to change notification settings - Fork 784
[client] Add env and status flags for netbird service command #3975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the Netbird CLI service commands by allowing permanent environment variables, adding new subcommands for reconfiguration and status reporting, and cleaning up shared setup logic. It also introduces tests covering service startup/shutdown and environment parsing.
- Added
--service-env
flag with parsing for extra service environment variables - Implemented
service reconfigure
andservice status
subcommands - Refactored common installer/controller setup into reusable functions
- Extended tests for service lifecycle and env var parsing
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
client/cmd/service.go | Defined top-level service command, flags, and environment parsing |
client/cmd/service_installer.go | Refactored install/reconfigure workflows, built service config helper |
client/cmd/service_controller.go | Centralized control-command setup, streamlined start/stop/restart |
client/cmd/service_test.go | Added lifecycle tests and parseServiceEnvVars unit tests |
client/cmd/root.go | Removed legacy service flags and moved service command registration |
.github/workflows/golang-test-linux.yml | Inject CONTAINER env to skip service tests in container runs |
Comments suppressed due to low confidence (1)
client/cmd/service_installer.go:156
- Introduce unit tests for the new
service reconfigure
andservice status
commands to verify their behavior and improve overall coverage.
var reconfigureCmd = &cobra.Command{
cmd.SetOut(cmd.OutOrStdout()) | ||
|
||
err := handleRebrand(cmd) | ||
ctx, cancel := context.WithCancel(cmd.Context()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding defer cancel()
immediately after creating the context to ensure any associated resources are released when the command completes.
ctx, cancel := context.WithCancel(cmd.Context()) | |
ctx, cancel := context.WithCancel(cmd.Context()) | |
defer cancel() |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Describe your changes
netbird service install --service-env
flag to add permanent env varsnetbird service reconfigure [flags]
command to reconfigure an already installed servicenetbird service status
commandIssue ticket number and link
Stack
Checklist