mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-19 21:29:09 +02:00
Partial revert coderabbit added docstrings
This commit is contained in:
+9
-16
@@ -104,14 +104,9 @@ var debugConfigCmd = &cobra.Command{
|
||||
// Useful for verifying MDM enforcement end-to-end: the response's
|
||||
// mDMManagedFields array is the single source of truth for "which
|
||||
// fields is the daemon currently enforcing from the MDM source", and
|
||||
// every config field side-by-side with that list confirms the
|
||||
// merge result. Secrets in the response (e.g. PreSharedKey) are
|
||||
// debugConfigDump requests the daemon for the resolved effective configuration and prints it as indented JSON.
|
||||
// It resolves the active profile and current OS user, calls DaemonService.GetConfig with those values, and
|
||||
// marshals the response using protojson with default/zero-valued fields included.
|
||||
// debugConfigDump prints the daemon's effective configuration for the active profile and current OS user as indented JSON.
|
||||
// It requests the configuration from the daemon and writes the protobuf response with default fields emitted to stdout.
|
||||
// Returns an error if active profile or user lookup fails, the daemon RPC fails, or the response cannot be marshaled.
|
||||
// every config field side-by-side with that list confirms the merge
|
||||
// result. Secrets in the response (e.g. PreSharedKey) are already
|
||||
// redacted by the daemon-side handler.
|
||||
func debugConfigDump(cmd *cobra.Command, _ []string) error {
|
||||
pm := profilemanager.NewProfileManager()
|
||||
activeProf, err := pm.GetActiveProfile()
|
||||
@@ -153,14 +148,12 @@ func debugConfigDump(cmd *cobra.Command, _ []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// debugBundle requests the daemon to create a debug bundle and prints the resulting
|
||||
// local file path and, if uploaded, the uploaded file key.
|
||||
// It uses the package flags (anonymize, system info, log file count, CLI version and
|
||||
// optional upload URL) to configure the bundle request. Returns an error if the RPC
|
||||
// debugBundle requests creation of a debug bundle from the daemon and prints
|
||||
// the local bundle file path and, if uploading was enabled, the uploaded file key.
|
||||
// It returns an error if the RPC fails, if the daemon reports an upload failure
|
||||
// reason, or if establishing the connection fails.
|
||||
// debugBundle requests the daemon to create a debug bundle and prints
|
||||
// the resulting local file path and, if uploaded, the uploaded file
|
||||
// key. It uses the package flags (anonymize, system info, log file
|
||||
// count, CLI version, optional upload URL) to configure the bundle
|
||||
// request. Returns an error if the RPC fails or if the daemon reports
|
||||
// an upload failure reason.
|
||||
func debugBundle(cmd *cobra.Command, _ []string) error {
|
||||
conn, err := getClient(cmd)
|
||||
if err != nil {
|
||||
|
||||
+10
-14
@@ -105,20 +105,16 @@ func Execute() error {
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
|
||||
// init initializes package-level defaults and the CLI command tree.
|
||||
// init sets platform-specific default config and log directory paths and a default daemon address,
|
||||
// registers persistent flags (daemon address, management/admin URLs, logging, setup key, preshared key,
|
||||
// hostname, anonymize, config path), attaches top-level and nested subcommands to the root command,
|
||||
// and configures `up` command specific flags (external IP maps, DNS resolver address, Rosenpass options,
|
||||
// init initializes package-level defaults and configures the root Cobra command.
|
||||
//
|
||||
// It sets default configuration and log directory paths (including legacy Wiretrustee
|
||||
// locations) based on the runtime OS, builds default config/log file paths, and selects
|
||||
// a platform-appropriate default daemon address. It registers persistent CLI flags
|
||||
// (including mutually exclusive setup-key and setup-key-file), attaches top-level
|
||||
// commands and subcommands to the root command, and registers `up`-specific persistent
|
||||
// flags for external IP mapping, custom DNS resolver address, Rosenpass options,
|
||||
// auto-connect disabling, and lazy connection.
|
||||
// init initialises package-level defaults and configures the root
|
||||
// Cobra command tree. Sets platform-specific config / log directory
|
||||
// paths (including legacy Wiretrustee fallbacks) and a default daemon
|
||||
// address; registers persistent CLI flags (daemon address,
|
||||
// management / admin URLs, logging, setup key (file and inline,
|
||||
// mutually exclusive), preshared key, hostname, anonymise, config
|
||||
// path); attaches top-level and nested subcommands to the root
|
||||
// command; and registers `up`-specific persistent flags (external IP
|
||||
// maps, custom DNS resolver address, Rosenpass options, auto-connect
|
||||
// disabling, lazy connection).
|
||||
func init() {
|
||||
defaultConfigPathDir = "/etc/netbird/"
|
||||
defaultLogFileDir = "/var/log/netbird/"
|
||||
|
||||
Reference in New Issue
Block a user