[#186] Improve wallet params
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
9d4049cfe3
commit
d8b04223d4
2 changed files with 10 additions and 8 deletions
10
app.go
10
app.go
|
@ -181,10 +181,7 @@ func remove(list []string, element string) []string {
|
|||
}
|
||||
|
||||
func getNeoFSKey(a *app) (*ecdsa.PrivateKey, error) {
|
||||
walletPath := a.cfg.GetString(cmdWallet)
|
||||
if len(walletPath) == 0 {
|
||||
walletPath = a.cfg.GetString(cfgWalletPath)
|
||||
}
|
||||
walletPath := a.cfg.GetString(cfgWalletPath)
|
||||
|
||||
if len(walletPath) == 0 {
|
||||
a.log.Info("no wallet path specified, creating ephemeral key automatically for this run")
|
||||
|
@ -205,10 +202,7 @@ func getNeoFSKey(a *app) (*ecdsa.PrivateKey, error) {
|
|||
password = &pwd
|
||||
}
|
||||
|
||||
address := a.cfg.GetString(cmdAddress)
|
||||
if len(address) == 0 {
|
||||
address = a.cfg.GetString(cfgWalletAddress)
|
||||
}
|
||||
address := a.cfg.GetString(cfgWalletAddress)
|
||||
|
||||
return getKeyFromWallet(w, address, password)
|
||||
}
|
||||
|
|
|
@ -154,6 +154,14 @@ func settings() *viper.Viper {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
if err := v.BindPFlag(cfgWalletPath, flags.Lookup(cmdWallet)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := v.BindPFlag(cfgWalletAddress, flags.Lookup(cmdAddress)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := v.BindPFlags(flags); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue