diff --git a/lib/cmds/blockchain/blockchain.js b/lib/cmds/blockchain/blockchain.js index 9ee2533f2..d0fa21372 100644 --- a/lib/cmds/blockchain/blockchain.js +++ b/lib/cmds/blockchain/blockchain.js @@ -50,7 +50,15 @@ var Blockchain = function(options) { this.config.datadir = fs.embarkPath(".embark/development/datadir"); } - this.client = new options.client({config: this.config, env: this.env}); + if (this.blockchainConfig.isDev) { + this.isDev = true; + } else if (this.blockchainConfig.isDev === false) { + this.isDev = false; + } else { + this.isDev = this.env === 'development'; + } + + this.client = new options.client({config: this.config, env: this.env, isDev: this.isDev}); }; Blockchain.prototype.runCommand = function(cmd, options) { @@ -76,7 +84,7 @@ Blockchain.prototype.run = function() { return; } let address = ''; - if (self.env !== "development") { + if (!this.isDev) { address = this.initChainAndGetAddress(); } this.client.mainCommand(address, function(cmd) { diff --git a/lib/cmds/blockchain/geth_commands.js b/lib/cmds/blockchain/geth_commands.js index c7e7dd2c6..84d28dcf0 100644 --- a/lib/cmds/blockchain/geth_commands.js +++ b/lib/cmds/blockchain/geth_commands.js @@ -5,6 +5,7 @@ class GethCommands { constructor(options) { this.config = options && options.hasOwnProperty('config') ? options.config : {}; this.env = options && options.hasOwnProperty('env') ? options.env : 'development'; + this.isDev = options && options.hasOwnProperty('isDev') ? options.isDev : (this.env === 'development'); this.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)"; this.geth_bin = this.config.geth_bin || "geth"; } @@ -123,7 +124,6 @@ class GethCommands { let config = this.config; let rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']); let ws_api = (this.config.wsApi || ['eth', 'web3', 'net']); - const isDev = self.env === 'development'; async.series([ function commonOptions(callback) { @@ -189,7 +189,7 @@ class GethCommands { } else { accountAddress = address; } - if (accountAddress && !isDev) { + if (accountAddress && !self.isDev) { return callback(null, "--unlock=" + accountAddress); } callback(null, ""); @@ -201,13 +201,13 @@ class GethCommands { callback(null, ""); }, function mineWhenNeeded(callback) { - if (config.mineWhenNeeded && !isDev) { + if (config.mineWhenNeeded && !self.isDev) { return callback(null, "js .embark/" + self.env + "/js/mine.js"); } callback(null, ""); }, function isDev(callback) { - if (isDev) { + if (self.isDev) { return callback(null, '--dev'); } callback(null, ''); diff --git a/templates/boilerplate/config/blockchain.json b/templates/boilerplate/config/blockchain.json index afff2072c..a7f318786 100644 --- a/templates/boilerplate/config/blockchain.json +++ b/templates/boilerplate/config/blockchain.json @@ -4,6 +4,7 @@ "networkType": "custom", "genesisBlock": "config/development/genesis.json", "datadir": ".embark/development/datadir", + "isDev": true, "mineWhenNeeded": true, "nodiscover": true, "maxpeers": 0, diff --git a/templates/demo/config/blockchain.json b/templates/demo/config/blockchain.json index 638c81673..5743c38dd 100644 --- a/templates/demo/config/blockchain.json +++ b/templates/demo/config/blockchain.json @@ -4,6 +4,7 @@ "networkType": "custom", "genesisBlock": "config/development/genesis.json", "datadir": ".embark/development/datadir", + "isDev": true, "mineWhenNeeded": true, "nodiscover": true, "maxpeers": 0, diff --git a/test/test1/config/blockchain.json b/test/test1/config/blockchain.json index 090f40788..fc0ba5e1f 100644 --- a/test/test1/config/blockchain.json +++ b/test/test1/config/blockchain.json @@ -3,6 +3,7 @@ "networkType": "custom", "genesisBlock": "config/development/genesis.json", "datadir": ".embark/development/datadir", + "isDev": true, "mineWhenNeeded": true, "nodiscover": true, "rpcHost": "localhost", diff --git a/test_apps/contracts_app/blockchain.json b/test_apps/contracts_app/blockchain.json index 35edfb43f..a574d4006 100644 --- a/test_apps/contracts_app/blockchain.json +++ b/test_apps/contracts_app/blockchain.json @@ -4,6 +4,7 @@ "networkType": "custom", "genesisBlock": "development/genesis.json", "datadir": ".embark/development/datadir", + "isDev": true, "mineWhenNeeded": true, "nodiscover": true, "maxpeers": 0, diff --git a/test_apps/test_app/config/blockchain.json b/test_apps/test_app/config/blockchain.json index 6acbdfd54..2b9baa50d 100644 --- a/test_apps/test_app/config/blockchain.json +++ b/test_apps/test_app/config/blockchain.json @@ -4,6 +4,7 @@ "networkType": "custom", "genesisBlock": "config/development/genesis.json", "datadir": ".embark/development/datadir", + "isDev": true, "mineWhenNeeded": true, "nodiscover": true, "maxpeers": 0,