All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m37s
Vulncheck / Vulncheck (pull_request) Successful in 1m33s
Build / Build Components (pull_request) Successful in 2m11s
Tests and linters / Staticcheck (pull_request) Successful in 2m29s
Tests and linters / Lint (pull_request) Successful in 3m20s
DCO action / DCO (pull_request) Successful in 28s
Tests and linters / Tests (pull_request) Successful in 1m39s
Tests and linters / gopls check (pull_request) Successful in 2m17s
Tests and linters / Tests with -race (pull_request) Successful in 5m28s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m9s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
47 lines
1.8 KiB
Go
47 lines
1.8 KiB
Go
package proxy
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
var (
|
|
AddAccountCmd = &cobra.Command{
|
|
Use: "proxy-add-account",
|
|
Short: "Adds account to proxy contract",
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
|
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
|
},
|
|
Run: addProxyAccount,
|
|
}
|
|
RemoveAccountCmd = &cobra.Command{
|
|
Use: "proxy-remove-account",
|
|
Short: "Remove from proxy contract",
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
|
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
|
},
|
|
Run: removeProxyAccount,
|
|
}
|
|
)
|
|
|
|
func initProxyAddAccount() {
|
|
AddAccountCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
|
AddAccountCmd.Flags().StringArray(accountAddressFlag, nil, "Wallet address string")
|
|
_ = AddAccountCmd.MarkFlagRequired(accountAddressFlag)
|
|
AddAccountCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
}
|
|
|
|
func initProxyRemoveAccount() {
|
|
RemoveAccountCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
|
RemoveAccountCmd.Flags().StringArray(accountAddressFlag, nil, "Wallet address string")
|
|
_ = AddAccountCmd.MarkFlagRequired(accountAddressFlag)
|
|
RemoveAccountCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
}
|
|
|
|
func init() {
|
|
initProxyAddAccount()
|
|
initProxyRemoveAccount()
|
|
}
|