[#932] adm: Move flags to package commonflags

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-02-02 15:04:48 +03:00
parent 7b0e3f5010
commit 814c411f4a
25 changed files with 255 additions and 241 deletions

View file

@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/config"
morphUtil "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring"
@ -26,7 +27,7 @@ import (
func AlphabetCreds(cmd *cobra.Command, _ []string) error {
// alphabet size is not part of the config
size, err := cmd.Flags().GetUint(morphUtil.AlphabetSizeFlag)
size, err := cmd.Flags().GetUint(commonflags.AlphabetSizeFlag)
if err != nil {
return err
}
@ -38,7 +39,7 @@ func AlphabetCreds(cmd *cobra.Command, _ []string) error {
}
v := viper.GetViper()
walletDir := config.ResolveHomePath(viper.GetString(morphUtil.AlphabetWalletsFlag))
walletDir := config.ResolveHomePath(viper.GetString(commonflags.AlphabetWalletsFlag))
pwds, err := initializeWallets(v, walletDir, int(size))
if err != nil {
return err
@ -138,7 +139,7 @@ func generateStorageCreds(cmd *cobra.Command, _ []string) error {
func refillGas(cmd *cobra.Command, gasFlag string, createWallet bool) (err error) {
// storage wallet path is not part of the config
storageWalletPath, _ := cmd.Flags().GetString(morphUtil.StorageWalletFlag)
storageWalletPath, _ := cmd.Flags().GetString(commonflags.StorageWalletFlag)
// wallet address is not part of the config
walletAddress, _ := cmd.Flags().GetString(walletAddressFlag)
@ -151,7 +152,7 @@ func refillGas(cmd *cobra.Command, gasFlag string, createWallet bool) (err error
}
} else {
if storageWalletPath == "" {
return fmt.Errorf("missing wallet path (use '--%s <out.json>')", morphUtil.StorageWalletFlag)
return fmt.Errorf("missing wallet path (use '--%s <out.json>')", commonflags.StorageWalletFlag)
}
var w *wallet.Wallet