mirror of https://github.com/embarklabs/embark.git
add isDev blockchain option
This commit is contained in:
parent
8278bcc496
commit
21a8303e84
|
@ -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) {
|
||||
|
|
|
@ -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, '');
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"networkType": "custom",
|
||||
"genesisBlock": "config/development/genesis.json",
|
||||
"datadir": ".embark/development/datadir",
|
||||
"isDev": true,
|
||||
"mineWhenNeeded": true,
|
||||
"nodiscover": true,
|
||||
"maxpeers": 0,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"networkType": "custom",
|
||||
"genesisBlock": "config/development/genesis.json",
|
||||
"datadir": ".embark/development/datadir",
|
||||
"isDev": true,
|
||||
"mineWhenNeeded": true,
|
||||
"nodiscover": true,
|
||||
"maxpeers": 0,
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"networkType": "custom",
|
||||
"genesisBlock": "config/development/genesis.json",
|
||||
"datadir": ".embark/development/datadir",
|
||||
"isDev": true,
|
||||
"mineWhenNeeded": true,
|
||||
"nodiscover": true,
|
||||
"rpcHost": "localhost",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"networkType": "custom",
|
||||
"genesisBlock": "development/genesis.json",
|
||||
"datadir": ".embark/development/datadir",
|
||||
"isDev": true,
|
||||
"mineWhenNeeded": true,
|
||||
"nodiscover": true,
|
||||
"maxpeers": 0,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"networkType": "custom",
|
||||
"genesisBlock": "config/development/genesis.json",
|
||||
"datadir": ".embark/development/datadir",
|
||||
"isDev": true,
|
||||
"mineWhenNeeded": true,
|
||||
"nodiscover": true,
|
||||
"maxpeers": 0,
|
||||
|
|
Loading…
Reference in New Issue