diff --git a/management/cmd/management.go b/management/cmd/management.go index 1b2216932..42919df9e 100644 --- a/management/cmd/management.go +++ b/management/cmd/management.go @@ -101,9 +101,9 @@ var ( // detect whether user specified a port userPort := cmd.Flag("port").Changed - config, err = loadMgmtConfig(ctx, mgmtConfig) + config, err = loadMgmtConfig(ctx, MgmtConfig) if err != nil { - return fmt.Errorf("failed reading provided config file: %s: %v", mgmtConfig, err) + return fmt.Errorf("failed reading provided config file: %s: %v", MgmtConfig, err) } if cmd.Flag(idpSignKeyRefreshEnabledFlagName).Changed { @@ -183,7 +183,7 @@ var ( if config.DataStoreEncryptionKey != key { log.WithContext(ctx).Infof("update config with activity store key") config.DataStoreEncryptionKey = key - err := updateMgmtConfig(ctx, mgmtConfig, config) + err := updateMgmtConfig(ctx, MgmtConfig, config) if err != nil { return fmt.Errorf("failed to write out store encryption key: %s", err) } @@ -636,7 +636,7 @@ func handleRebrand(cmd *cobra.Command) error { } } } - if mgmtConfig == defaultMgmtConfig { + if MgmtConfig == defaultMgmtConfig { if migrateToNetbird(oldDefaultMgmtConfig, defaultMgmtConfig) { cmd.Printf("will copy Config dir %s and its content to %s\n", oldDefaultMgmtConfigDir, defaultMgmtConfigDir) err = cpDir(oldDefaultMgmtConfigDir, defaultMgmtConfigDir) diff --git a/management/cmd/root.go b/management/cmd/root.go index 86155a956..6d05c9563 100644 --- a/management/cmd/root.go +++ b/management/cmd/root.go @@ -19,7 +19,7 @@ const ( var ( dnsDomain string mgmtDataDir string - mgmtConfig string + MgmtConfig string logLevel string logFile string disableMetrics bool @@ -56,7 +56,7 @@ func init() { mgmtCmd.Flags().IntVar(&mgmtPort, "port", 80, "server port to listen on (defaults to 443 if TLS is enabled, 80 otherwise") mgmtCmd.Flags().IntVar(&mgmtMetricsPort, "metrics-port", 9090, "metrics endpoint http port. Metrics are accessible under host:metrics-port/metrics") mgmtCmd.Flags().StringVar(&mgmtDataDir, "datadir", defaultMgmtDataDir, "server data directory location") - mgmtCmd.Flags().StringVar(&mgmtConfig, "config", defaultMgmtConfig, "Netbird config file location. Config params specified via command line (e.g. datadir) have a precedence over configuration from this file") + mgmtCmd.Flags().StringVar(&MgmtConfig, "config", defaultMgmtConfig, "Netbird config file location. Config params specified via command line (e.g. datadir) have a precedence over configuration from this file") mgmtCmd.Flags().StringVar(&mgmtLetsencryptDomain, "letsencrypt-domain", "", "a domain to issue Let's Encrypt certificate for. Enables TLS using Let's Encrypt. Will fetch and renew certificate, and run the server with TLS") mgmtCmd.Flags().StringVar(&mgmtSingleAccModeDomain, "single-account-mode-domain", defaultSingleAccModeDomain, "Enables single account mode. This means that all the users will be under the same account grouped by the specified domain. If the installation has more than one account, the property is ineffective. Enabled by default with the default domain "+defaultSingleAccModeDomain) mgmtCmd.Flags().BoolVar(&disableSingleAccMode, "disable-single-account-mode", false, "If set to true, disables single account mode. The --single-account-mode-domain property will be ignored and every new user will have a separate NetBird account.")