[#932] adm: Move generate.go
to package generate
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
b8cf0a6b88
commit
86b2515744
6 changed files with 104 additions and 92 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/container"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/contract"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/frostfsid"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/generate"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/node"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/notary"
|
||||
|
@ -18,12 +19,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
alphabetSizeFlag = "size"
|
||||
|
||||
storageWalletLabelFlag = "label"
|
||||
storageGasCLIFlag = "initial-gas"
|
||||
storageGasConfigFlag = "storage.initial_gas"
|
||||
|
||||
maxObjectSizeCLIFlag = "max-object-size"
|
||||
|
||||
epochDurationCLIFlag = "epoch-duration"
|
||||
|
@ -36,8 +31,6 @@ const (
|
|||
homomorphicHashDisabledCLIFlag = "homomorphic-disabled"
|
||||
|
||||
withdrawFeeCLIFlag = "withdraw-fee"
|
||||
|
||||
walletAddressFlag = "wallet-address"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -47,16 +40,6 @@ var (
|
|||
Short: "Section for morph network configuration commands",
|
||||
}
|
||||
|
||||
generateAlphabetCmd = &cobra.Command{
|
||||
Use: "generate-alphabet",
|
||||
Short: "Generate alphabet wallets for consensus nodes of the morph network",
|
||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||
// PreRun fixes https://github.com/spf13/viper/issues/233
|
||||
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
||||
},
|
||||
RunE: generateAlphabetCreds,
|
||||
}
|
||||
|
||||
initCmd = &cobra.Command{
|
||||
Use: "init",
|
||||
Short: "Initialize side chain network with smart-contracts and network settings",
|
||||
|
@ -74,37 +57,13 @@ var (
|
|||
},
|
||||
RunE: initializeSideChainCmd,
|
||||
}
|
||||
|
||||
generateStorageCmd = &cobra.Command{
|
||||
Use: "generate-storage-wallet",
|
||||
Short: "Generate storage node wallet for the morph 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))
|
||||
_ = viper.BindPFlag(storageGasConfigFlag, cmd.Flags().Lookup(storageGasCLIFlag))
|
||||
},
|
||||
RunE: generateStorageCreds,
|
||||
}
|
||||
|
||||
refillGasCmd = &cobra.Command{
|
||||
Use: "refill-gas",
|
||||
Short: "Refill GAS of storage node's wallet in the morph 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))
|
||||
_ = viper.BindPFlag(util.RefillGasAmountFlag, cmd.Flags().Lookup(util.RefillGasAmountFlag))
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return refillGas(cmd, util.RefillGasAmountFlag, false)
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
initGenerateAlphabetCmd()
|
||||
RootCmd.AddCommand(generate.RefillGasCmd)
|
||||
initInitCmd()
|
||||
RootCmd.AddCommand(contract.DeployCmd)
|
||||
initGenerateStorageCmd()
|
||||
RootCmd.AddCommand(generate.GenerateStorageCmd)
|
||||
RootCmd.AddCommand(netmap.ForceNewEpoch)
|
||||
RootCmd.AddCommand(node.RemoveCmd)
|
||||
RootCmd.AddCommand(policy.Set)
|
||||
|
@ -117,7 +76,7 @@ func init() {
|
|||
RootCmd.AddCommand(container.ListCmd)
|
||||
RootCmd.AddCommand(container.RestoreCmd)
|
||||
RootCmd.AddCommand(container.DumpCmd)
|
||||
initRefillGasCmd()
|
||||
RootCmd.AddCommand(generate.GenerateAlphabetCmd)
|
||||
RootCmd.AddCommand(notary.DepositCmd)
|
||||
RootCmd.AddCommand(netmap.CandidatesCmd)
|
||||
|
||||
|
@ -128,25 +87,6 @@ func init() {
|
|||
RootCmd.AddCommand(frostfsid.Cmd)
|
||||
}
|
||||
|
||||
func initRefillGasCmd() {
|
||||
RootCmd.AddCommand(refillGasCmd)
|
||||
refillGasCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||
refillGasCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
||||
refillGasCmd.Flags().String(util.StorageWalletFlag, "", "Path to storage node wallet")
|
||||
refillGasCmd.Flags().String(walletAddressFlag, "", "Address of wallet")
|
||||
refillGasCmd.Flags().String(util.RefillGasAmountFlag, "", "Additional amount of GAS to transfer")
|
||||
refillGasCmd.MarkFlagsMutuallyExclusive(walletAddressFlag, util.StorageWalletFlag)
|
||||
}
|
||||
|
||||
func initGenerateStorageCmd() {
|
||||
RootCmd.AddCommand(generateStorageCmd)
|
||||
generateStorageCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||
generateStorageCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
||||
generateStorageCmd.Flags().String(util.StorageWalletFlag, "", "Path to new storage node wallet")
|
||||
generateStorageCmd.Flags().String(storageGasCLIFlag, "", "Initial amount of GAS to transfer")
|
||||
generateStorageCmd.Flags().StringP(storageWalletLabelFlag, "l", "", "Wallet label")
|
||||
}
|
||||
|
||||
func initInitCmd() {
|
||||
RootCmd.AddCommand(initCmd)
|
||||
initCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||
|
@ -163,9 +103,3 @@ func initInitCmd() {
|
|||
initCmd.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
||||
initCmd.MarkFlagsMutuallyExclusive(util.ContractsInitFlag, util.ContractsURLFlag)
|
||||
}
|
||||
|
||||
func initGenerateAlphabetCmd() {
|
||||
RootCmd.AddCommand(generateAlphabetCmd)
|
||||
generateAlphabetCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||
generateAlphabetCmd.Flags().Uint(alphabetSizeFlag, 7, "Amount of alphabet wallets to generate")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue