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.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) {
|
Blockchain.prototype.runCommand = function(cmd, options) {
|
||||||
|
@ -76,7 +84,7 @@ Blockchain.prototype.run = function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let address = '';
|
let address = '';
|
||||||
if (self.env !== "development") {
|
if (!this.isDev) {
|
||||||
address = this.initChainAndGetAddress();
|
address = this.initChainAndGetAddress();
|
||||||
}
|
}
|
||||||
this.client.mainCommand(address, function(cmd) {
|
this.client.mainCommand(address, function(cmd) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ class GethCommands {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.config = options && options.hasOwnProperty('config') ? options.config : {};
|
this.config = options && options.hasOwnProperty('config') ? options.config : {};
|
||||||
this.env = options && options.hasOwnProperty('env') ? options.env : 'development';
|
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.name = "Go-Ethereum (https://github.com/ethereum/go-ethereum)";
|
||||||
this.geth_bin = this.config.geth_bin || "geth";
|
this.geth_bin = this.config.geth_bin || "geth";
|
||||||
}
|
}
|
||||||
|
@ -123,7 +124,6 @@ class GethCommands {
|
||||||
let config = this.config;
|
let config = this.config;
|
||||||
let rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']);
|
let rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']);
|
||||||
let ws_api = (this.config.wsApi || ['eth', 'web3', 'net']);
|
let ws_api = (this.config.wsApi || ['eth', 'web3', 'net']);
|
||||||
const isDev = self.env === 'development';
|
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
function commonOptions(callback) {
|
function commonOptions(callback) {
|
||||||
|
@ -189,7 +189,7 @@ class GethCommands {
|
||||||
} else {
|
} else {
|
||||||
accountAddress = address;
|
accountAddress = address;
|
||||||
}
|
}
|
||||||
if (accountAddress && !isDev) {
|
if (accountAddress && !self.isDev) {
|
||||||
return callback(null, "--unlock=" + accountAddress);
|
return callback(null, "--unlock=" + accountAddress);
|
||||||
}
|
}
|
||||||
callback(null, "");
|
callback(null, "");
|
||||||
|
@ -201,13 +201,13 @@ class GethCommands {
|
||||||
callback(null, "");
|
callback(null, "");
|
||||||
},
|
},
|
||||||
function mineWhenNeeded(callback) {
|
function mineWhenNeeded(callback) {
|
||||||
if (config.mineWhenNeeded && !isDev) {
|
if (config.mineWhenNeeded && !self.isDev) {
|
||||||
return callback(null, "js .embark/" + self.env + "/js/mine.js");
|
return callback(null, "js .embark/" + self.env + "/js/mine.js");
|
||||||
}
|
}
|
||||||
callback(null, "");
|
callback(null, "");
|
||||||
},
|
},
|
||||||
function isDev(callback) {
|
function isDev(callback) {
|
||||||
if (isDev) {
|
if (self.isDev) {
|
||||||
return callback(null, '--dev');
|
return callback(null, '--dev');
|
||||||
}
|
}
|
||||||
callback(null, '');
|
callback(null, '');
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "development/genesis.json",
|
"genesisBlock": "development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
"isDev": true,
|
||||||
"mineWhenNeeded": true,
|
"mineWhenNeeded": true,
|
||||||
"nodiscover": true,
|
"nodiscover": true,
|
||||||
"maxpeers": 0,
|
"maxpeers": 0,
|
||||||
|
|
Loading…
Reference in New Issue