diff --git a/lib/blockchain.js b/lib/blockchain.js index 8d566937f..d2209c48e 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -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, diff --git a/lib/geth_commands.js b/lib/geth_commands.js index 49d6ff2d0..b84f1f447 100644 --- a/lib/geth_commands.js +++ b/lib/geth_commands.js @@ -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(); diff --git a/test/blockchain.js b/test/blockchain.js index b714a079d..1183d9633 100644 --- a/test/blockchain.js +++ b/test/blockchain.js @@ -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',