package config import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" "github.com/spf13/cobra" "github.com/spf13/viper" ) var ( SetCmd = &cobra.Command{ Use: "set-config key1=val1 [key2=val2 ...]", DisableFlagsInUseLine: true, Short: "Add/update global config value in the FrostFS network", PreRun: func(cmd *cobra.Command, _ []string) { _ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag)) _ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag)) }, Args: cobra.MinimumNArgs(1), RunE: SetConfigCmd, } DumpCmd = &cobra.Command{ Use: "dump-config", Short: "Dump FrostFS network config", PreRun: func(cmd *cobra.Command, _ []string) { _ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag)) }, RunE: dumpNetworkConfig, } ) func initSetConfigCmd() { SetCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc) SetCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc) SetCmd.Flags().Bool(forceConfigSet, false, "Force setting not well-known configuration key") SetCmd.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file") } func initDumpNetworkConfigCmd() { DumpCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc) } func init() { initSetConfigCmd() initDumpNetworkConfigCmd() }