add config to specify geth command

This commit is contained in:
Iuri Matias 2017-02-18 08:55:33 -05:00
parent 03a6b6c48d
commit 655114b394
3 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,7 @@ var Blockchain = function(blockchainConfig, Client) {
this.blockchainConfig = blockchainConfig;
this.config = {
geth_bin: this.blockchainConfig.geth_bin || 'geth',
networkType: this.blockchainConfig.networkType || 'custom',
genesisBlock: this.blockchainConfig.genesisBlock || false,
datadir: this.blockchainConfig.datadir || false,

View File

@ -2,6 +2,7 @@
var GethCommands = function(options) {
this.config = options.config;
this.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)";
this.geth_bin = this.config.geth_bin || "geth";
};
GethCommands.prototype.commonOptions = function() {
@ -29,7 +30,7 @@ GethCommands.prototype.commonOptions = function() {
GethCommands.prototype.initGenesisCommmand = function() {
var config = this.config;
var cmd = "geth " + this.commonOptions();
var cmd = this.geth_bin + " " + this.commonOptions();
if (config.genesisBlock) {
cmd += "init \"" + config.genesisBlock + "\" ";
@ -39,16 +40,16 @@ GethCommands.prototype.initGenesisCommmand = function() {
};
GethCommands.prototype.newAccountCommand = function() {
return "geth " + this.commonOptions() + "account new ";
return this.geth_bin + " " + this.commonOptions() + "account new ";
};
GethCommands.prototype.listAccountsCommand = function() {
return "geth " + this.commonOptions() + "account list ";
return this.geth_bin + " " + this.commonOptions() + "account list ";
};
GethCommands.prototype.mainCommand = function(address) {
var config = this.config;
var cmd = "geth ";
var cmd = this.geth_bin + " ";
var rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']);
cmd += this.commonOptions();

View File

@ -14,6 +14,7 @@ describe('embark.Blockchain', function() {
var config = {
networkType: 'custom',
genesisBlock: false,
geth_bin: 'geth',
datadir: false,
mineWhenNeeded: false,
rpcHost: 'localhost',
@ -41,6 +42,7 @@ describe('embark.Blockchain', function() {
var config = {
networkType: 'livenet',
genesisBlock: 'foo/bar/genesis.json',
geth_bin: 'geth',
datadir: '/foo/datadir/',
mineWhenNeeded: true,
rpcHost: 'someserver',