forked from TrueCloudLab/frostfs-node
[#683] cmd/neofs-adm: Add CLI flags for morph commands
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
c20eb15bd5
commit
6bf01a0a22
6 changed files with 185 additions and 0 deletions
45
cmd/neofs-adm/internal/modules/morph/generate.go
Normal file
45
cmd/neofs-adm/internal/modules/morph/generate.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package morph
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func generateAlphabetCreds(cmd *cobra.Command, args []string) error {
|
||||
// alphabet size is not part of the config
|
||||
size, err := cmd.Flags().GetUint(alphabetSizeFlag)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pwds := make([]string, size)
|
||||
for i := 0; i < int(size); i++ {
|
||||
pwds[i], err = config.AlphabetPassword(viper.GetViper(), i)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Println("size:", size)
|
||||
cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag))
|
||||
for i := range pwds {
|
||||
cmd.Printf("wallet[%d]: %s\n", i, pwds[i])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateStorageCreds(cmd *cobra.Command, args []string) error {
|
||||
// storage wallet path is not part of the config
|
||||
storageWalletPath, err := cmd.Flags().GetString(storageWalletFlag)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.Println("endpoint:", viper.GetString(endpointFlag))
|
||||
cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag))
|
||||
cmd.Println("storage-wallet:", storageWalletPath)
|
||||
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue