Resolve private key path instead of forcing inside dApp root
This commit is contained in:
parent
636e5a09ac
commit
12c495502d
|
@ -4,6 +4,8 @@ const ethereumjsWallet = require('ethereumjs-wallet');
|
||||||
const fs = require('../core/fs');
|
const fs = require('../core/fs');
|
||||||
const {getHexBalanceFromString} = require('../utils/utils');
|
const {getHexBalanceFromString} = require('../utils/utils');
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
class AccountParser {
|
class AccountParser {
|
||||||
static parseAccountsConfig(accountsConfig, web3, logger) {
|
static parseAccountsConfig(accountsConfig, web3, logger) {
|
||||||
let accounts = [];
|
let accounts = [];
|
||||||
|
@ -49,7 +51,8 @@ class AccountParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accountConfig.privateKeyFile) {
|
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) {
|
if (accountConfig.password) {
|
||||||
try {
|
try {
|
||||||
fileContent = JSON.parse(fileContent);
|
fileContent = JSON.parse(fileContent);
|
||||||
|
|
Loading…
Reference in New Issue