forked from TrueCloudLab/frostfs-node
[#932] adm: Move dump/set-config
to package config
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
f7a8f51c66
commit
be15eab82a
8 changed files with 142 additions and 124 deletions
46
cmd/frostfs-adm/internal/modules/morph/config/root.go
Normal file
46
cmd/frostfs-adm/internal/modules/morph/config/root.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
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()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue