2024-02-01 14:28:10 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2024-02-02 12:04:48 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
|
2024-02-01 14:28:10 +00:00
|
|
|
"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) {
|
2024-02-02 12:04:48 +00:00
|
|
|
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
2024-02-01 14:28:10 +00:00
|
|
|
},
|
|
|
|
Args: cobra.MinimumNArgs(1),
|
|
|
|
RunE: SetConfigCmd,
|
|
|
|
}
|
|
|
|
|
|
|
|
DumpCmd = &cobra.Command{
|
|
|
|
Use: "dump-config",
|
|
|
|
Short: "Dump FrostFS network config",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-02 12:04:48 +00:00
|
|
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
2024-02-01 14:28:10 +00:00
|
|
|
},
|
|
|
|
RunE: dumpNetworkConfig,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
func initSetConfigCmd() {
|
2024-02-02 12:04:48 +00:00
|
|
|
SetCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
|
|
SetCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
2024-02-01 14:28:10 +00:00
|
|
|
SetCmd.Flags().Bool(forceConfigSet, false, "Force setting not well-known configuration key")
|
2024-02-02 12:04:48 +00:00
|
|
|
SetCmd.Flags().String(commonflags.LocalDumpFlag, "", "Path to the blocks dump file")
|
2024-02-01 14:28:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func initDumpNetworkConfigCmd() {
|
2024-02-02 12:04:48 +00:00
|
|
|
DumpCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
2024-02-01 14:28:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
initSetConfigCmd()
|
|
|
|
initDumpNetworkConfigCmd()
|
|
|
|
}
|