Merge pull request #888 from embark-framework/bugfix/resolve-private-key-path

Resolve private key path instead of forcing inside dApp root
This commit is contained in:
Iuri Matias 2018-09-21 18:29:02 -04:00 committed by GitHub
commit 2586b0dc14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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);