From 12c495502d59f8a209efae1a114fd9fd3f4c9955 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Fri, 21 Sep 2018 14:04:04 -0400 Subject: [PATCH] Resolve private key path instead of forcing inside dApp root --- lib/utils/accountParser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/utils/accountParser.js b/lib/utils/accountParser.js index ee329a9c4..ec8b038a1 100644 --- a/lib/utils/accountParser.js +++ b/lib/utils/accountParser.js @@ -4,6 +4,8 @@ const ethereumjsWallet = require('ethereumjs-wallet'); const fs = require('../core/fs'); const {getHexBalanceFromString} = require('../utils/utils'); +const path = require('path'); + class AccountParser { static parseAccountsConfig(accountsConfig, web3, logger) { let accounts = []; @@ -49,7 +51,8 @@ class AccountParser { } if (accountConfig.privateKeyFile) { - let fileContent = fs.readFileSync(fs.dappPath(accountConfig.privateKeyFile)).toString(); + let privateKeyFile = path.resolve(fs.dappPath(), accountConfig.privateKeyFile); + let fileContent = fs.readFileSync(privateKeyFile).toString(); if (accountConfig.password) { try { fileContent = JSON.parse(fileContent);