Provide a default value for secretsDir (similar to validatorsDir)
This commit is contained in:
parent
a75c632f7a
commit
2acda1c115
|
@ -105,11 +105,11 @@ type
|
||||||
abbr: "v"
|
abbr: "v"
|
||||||
name: "validator" }: seq[ValidatorKeyPath]
|
name: "validator" }: seq[ValidatorKeyPath]
|
||||||
|
|
||||||
validatorsDir* {.
|
validatorsDirFlag* {.
|
||||||
desc: "A directory containing validator keystores."
|
desc: "A directory containing validator keystores."
|
||||||
name: "validators-dir" }: Option[InputDir]
|
name: "validators-dir" }: Option[InputDir]
|
||||||
|
|
||||||
secretsDir* {.
|
secretsDirFlag* {.
|
||||||
desc: "A directory containing validator keystore passwords."
|
desc: "A directory containing validator keystore passwords."
|
||||||
name: "secrets-dir" }: Option[InputDir]
|
name: "secrets-dir" }: Option[InputDir]
|
||||||
|
|
||||||
|
@ -324,8 +324,11 @@ proc defaultDataDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
||||||
func dumpDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
func dumpDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
||||||
conf.dataDir / "dump"
|
conf.dataDir / "dump"
|
||||||
|
|
||||||
func localValidatorsDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
func validatorsDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
||||||
string conf.validatorsDir.get(InputDir(conf.dataDir / "validators"))
|
string conf.validatorsDirFlag.get(InputDir(conf.dataDir / "validators"))
|
||||||
|
|
||||||
|
func secretsDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
||||||
|
string conf.secretsDirFlag.get(InputDir(conf.dataDir / "secrets"))
|
||||||
|
|
||||||
func databaseDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
func databaseDir*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
||||||
conf.dataDir / "db"
|
conf.dataDir / "db"
|
||||||
|
|
|
@ -29,8 +29,7 @@ proc loadKeyStore(conf: BeaconNodeConf|ValidatorClientConf,
|
||||||
error "Failed to read keystore", err = err.msg, path = keystorePath
|
error "Failed to read keystore", err = err.msg, path = keystorePath
|
||||||
return
|
return
|
||||||
|
|
||||||
if conf.secretsDir.isSome:
|
let passphrasePath = conf.secretsDir / keyName
|
||||||
let passphrasePath = conf.secretsDir.get / keyName
|
|
||||||
if fileExists(passphrasePath):
|
if fileExists(passphrasePath):
|
||||||
let
|
let
|
||||||
passphrase = KeyStorePass:
|
passphrase = KeyStorePass:
|
||||||
|
@ -76,7 +75,7 @@ iterator validatorKeys*(conf: BeaconNodeConf|ValidatorClientConf): ValidatorPriv
|
||||||
file = validatorKeyFile.string, err = err.msg
|
file = validatorKeyFile.string, err = err.msg
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
let validatorsDir = conf.localValidatorsDir
|
let validatorsDir = conf.validatorsDir
|
||||||
try:
|
try:
|
||||||
for kind, file in walkDir(validatorsDir):
|
for kind, file in walkDir(validatorsDir):
|
||||||
if kind == pcDir:
|
if kind == pcDir:
|
||||||
|
|
|
@ -34,7 +34,7 @@ declareCounter beacon_blocks_proposed,
|
||||||
logScope: topics = "beacval"
|
logScope: topics = "beacval"
|
||||||
|
|
||||||
proc saveValidatorKey*(keyName, key: string, conf: BeaconNodeConf) =
|
proc saveValidatorKey*(keyName, key: string, conf: BeaconNodeConf) =
|
||||||
let validatorsDir = conf.localValidatorsDir
|
let validatorsDir = conf.validatorsDir
|
||||||
let outputFile = validatorsDir / keyName
|
let outputFile = validatorsDir / keyName
|
||||||
createDir validatorsDir
|
createDir validatorsDir
|
||||||
writeFile(outputFile, key)
|
writeFile(outputFile, key)
|
||||||
|
|
|
@ -212,7 +212,7 @@ for NUM_NODE in $(seq 0 $((NUM_NODES - 1))); do
|
||||||
if [[ $NUM_NODE -lt $NODES_WITH_VALIDATORS ]]; then
|
if [[ $NUM_NODE -lt $NODES_WITH_VALIDATORS ]]; then
|
||||||
for VALIDATOR in $(ls ${DEPOSITS_DIR} | tail -n +$(( $USER_VALIDATORS + ($VALIDATORS_PER_NODE * $NUM_NODE) + 1 )) | head -n $VALIDATORS_PER_NODE); do
|
for VALIDATOR in $(ls ${DEPOSITS_DIR} | tail -n +$(( $USER_VALIDATORS + ($VALIDATORS_PER_NODE * $NUM_NODE) + 1 )) | head -n $VALIDATORS_PER_NODE); do
|
||||||
cp -ar "${DEPOSITS_DIR}/$VALIDATOR" "${NODE_DATA_DIR}/validators/"
|
cp -ar "${DEPOSITS_DIR}/$VALIDATOR" "${NODE_DATA_DIR}/validators/"
|
||||||
cp -a "${SECRETS_DIR}/${VALIDATOR}" "${NODE_DATA_DIR}/secrets"
|
cp -a "${SECRETS_DIR}/${VALIDATOR}" "${NODE_DATA_DIR}/secrets/"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue