fix default --key-store location if --data-dir is custom
This commit is contained in:
parent
d98b3bb32d
commit
e36d2f432a
|
@ -733,6 +733,11 @@ proc makeConfig*(cmdLine = commandLineParams()): NimbusConf =
|
||||||
result.rpcEnabled = result.rpcEnabled or rpcMustEnabled
|
result.rpcEnabled = result.rpcEnabled or rpcMustEnabled
|
||||||
result.wsEnabled = result.wsEnabled or wsMustEnabled
|
result.wsEnabled = result.wsEnabled or wsMustEnabled
|
||||||
|
|
||||||
|
# see issue #1346
|
||||||
|
if result.keyStore.string == defaultKeystoreDir() and
|
||||||
|
result.dataDir.string != defaultDataDir():
|
||||||
|
result.keyStore = OutDir(result.dataDir.string / "keystore")
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
# for testing purpose
|
# for testing purpose
|
||||||
discard makeConfig()
|
discard makeConfig()
|
||||||
|
|
|
@ -257,5 +257,24 @@ proc configurationMain*() =
|
||||||
let pkhex2 = rc2.get.seckey.toRaw.to0xHex
|
let pkhex2 = rc2.get.seckey.toRaw.to0xHex
|
||||||
check pkhex1 == pkhex2
|
check pkhex1 == pkhex2
|
||||||
|
|
||||||
|
test "default key-store and default data-dir":
|
||||||
|
let conf = makeTestConfig()
|
||||||
|
check conf.keyStore.string == conf.dataDir.string / "keystore"
|
||||||
|
|
||||||
|
test "custom key-store and custom data-dir":
|
||||||
|
let conf = makeConfig(@["--key-store:banana", "--data-dir:apple"])
|
||||||
|
check conf.keyStore.string == "banana"
|
||||||
|
check conf.dataDir.string == "apple"
|
||||||
|
|
||||||
|
test "default key-store and custom data-dir":
|
||||||
|
let conf = makeConfig(@["--data-dir:apple"])
|
||||||
|
check conf.dataDir.string == "apple"
|
||||||
|
check conf.keyStore.string == "apple" / "keystore"
|
||||||
|
|
||||||
|
test "custom key-store and default data-dir":
|
||||||
|
let conf = makeConfig(@["--key-store:banana"])
|
||||||
|
check conf.dataDir.string == defaultDataDir()
|
||||||
|
check conf.keyStore.string == "banana"
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
configurationMain()
|
configurationMain()
|
||||||
|
|
Loading…
Reference in New Issue