Merge PR #7485: keyring-dir flag
This commit is contained in:
+9
-2
@@ -32,6 +32,7 @@ type Context struct {
|
||||
OutputFormat string
|
||||
Height int64
|
||||
HomeDir string
|
||||
KeyringDir string
|
||||
From string
|
||||
BroadcastMode string
|
||||
FromName string
|
||||
@@ -134,6 +135,12 @@ func (ctx Context) WithHomeDir(dir string) Context {
|
||||
return ctx
|
||||
}
|
||||
|
||||
// WithKeyringDir returns a copy of the Context with KeyringDir set.
|
||||
func (ctx Context) WithKeyringDir(dir string) Context {
|
||||
ctx.KeyringDir = dir
|
||||
return ctx
|
||||
}
|
||||
|
||||
// WithGenerateOnly returns a copy of the context with updated GenerateOnly value
|
||||
func (ctx Context) WithGenerateOnly(generateOnly bool) Context {
|
||||
ctx.GenerateOnly = generateOnly
|
||||
@@ -302,8 +309,8 @@ func GetFromFields(kr keyring.Keyring, from string, genOnly bool) (sdk.AccAddres
|
||||
|
||||
func newKeyringFromFlags(ctx Context, backend string) (keyring.Keyring, error) {
|
||||
if ctx.GenerateOnly {
|
||||
return keyring.New(sdk.KeyringServiceName(), keyring.BackendMemory, ctx.HomeDir, ctx.Input)
|
||||
return keyring.New(sdk.KeyringServiceName(), keyring.BackendMemory, ctx.KeyringDir, ctx.Input)
|
||||
}
|
||||
|
||||
return keyring.New(sdk.KeyringServiceName(), backend, ctx.HomeDir, ctx.Input)
|
||||
return keyring.New(sdk.KeyringServiceName(), backend, ctx.KeyringDir, ctx.Input)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user