aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-03-08 16:32:33 +0800
committerFelix Lange <fjl@twurst.com>2016-03-08 16:32:33 +0800
commit848e50d6fb94435891cf6e19f29e30d622ddfe9b (patch)
treeccf6f9fb9847dce953ca719aaf79dac5f0c6f50f /cmd
parentbc63a3d282eedc4641def57cfb1c684de580a74b (diff)
parent627c2311fb2feaafdd55d444c3c2770d33c5b052 (diff)
downloadgo-tangerine-848e50d6fb94435891cf6e19f29e30d622ddfe9b.tar.gz
go-tangerine-848e50d6fb94435891cf6e19f29e30d622ddfe9b.tar.zst
go-tangerine-848e50d6fb94435891cf6e19f29e30d622ddfe9b.zip
Merge pull request #2293 from kobigurk/develop
Adds --keystore
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/main.go1
-rw-r--r--cmd/geth/usage.go1
-rw-r--r--cmd/utils/flags.go19
3 files changed, 19 insertions, 2 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 8594d18c5..68e09912b 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -284,6 +284,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.GenesisFileFlag,
utils.BootnodesFlag,
utils.DataDirFlag,
+ utils.KeyStoreDirFlag,
utils.BlockchainVersionFlag,
utils.OlympicFlag,
utils.FastSyncFlag,
diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go
index 051c51878..d2f76eaa6 100644
--- a/cmd/geth/usage.go
+++ b/cmd/geth/usage.go
@@ -63,6 +63,7 @@ var AppHelpFlagGroups = []flagGroup{
Name: "ETHEREUM",
Flags: []cli.Flag{
utils.DataDirFlag,
+ utils.KeyStoreDirFlag,
utils.NetworkIdFlag,
utils.OlympicFlag,
utils.TestNetFlag,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index adcc0adca..3efb65e42 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -102,6 +102,10 @@ var (
Usage: "Data directory for the databases and keystore",
Value: DirectoryString{common.DefaultDataDir()},
}
+ KeyStoreDirFlag = DirectoryFlag{
+ Name: "keystore",
+ Usage: "Directory for the keystore (default = inside the datadir)",
+ }
NetworkIdFlag = cli.IntFlag{
Name: "networkid",
Usage: "Network identifier (integer, 0=Olympic, 1=Frontier, 2=Morden)",
@@ -393,6 +397,16 @@ func MustMakeDataDir(ctx *cli.Context) string {
return ""
}
+// MakeKeyStoreDir resolves the folder to use for storing the account keys from the
+// set command line flags, returning the explicitly requested path, or one inside
+// the data directory otherwise.
+func MakeKeyStoreDir(datadir string, ctx *cli.Context) string {
+ if path := ctx.GlobalString(KeyStoreDirFlag.Name); path != "" {
+ return path
+ }
+ return filepath.Join(datadir, "keystore")
+}
+
// MakeIPCPath creates an IPC path configuration from the set command line flags,
// returning an empty string if IPC was explicitly disabled, or the set path.
func MakeIPCPath(ctx *cli.Context) string {
@@ -525,8 +539,9 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
}
// Assemble an account manager using the configured datadir
var (
- datadir = MustMakeDataDir(ctx)
- keystore = crypto.NewKeyStorePassphrase(filepath.Join(datadir, "keystore"), scryptN, scryptP)
+ datadir = MustMakeDataDir(ctx)
+ keystoredir = MakeKeyStoreDir(datadir, ctx)
+ keystore = crypto.NewKeyStorePassphrase(keystoredir, scryptN, scryptP)
)
return accounts.NewManager(keystore)
}