added ability to boot nodes via a list
This commit is contained in:
parent
e084b53dc1
commit
b3cec8287b
|
@ -23,6 +23,9 @@ staging:
|
|||
network_id: 0
|
||||
max_peers: 4
|
||||
console: true
|
||||
bootnodes:
|
||||
boot: false
|
||||
enodes: [] #insert enode urls here.
|
||||
account:
|
||||
init: false
|
||||
address:
|
||||
|
@ -34,6 +37,9 @@ production:
|
|||
network_id: 1
|
||||
max_peers: 4
|
||||
console: true
|
||||
bootnodes:
|
||||
boot: false
|
||||
enodes: []
|
||||
account:
|
||||
init: false
|
||||
address:
|
||||
|
|
|
@ -69,6 +69,12 @@ Blockchain.prototype.run_command = function(address, use_tmp) {
|
|||
cmd += "--unlock " + address + " ";
|
||||
}
|
||||
|
||||
if (config.bootNodes.init == true){
|
||||
cmd += "--bootnodes ";
|
||||
for (var i = 0; i < config.bootNodes.enodes.length; i++){
|
||||
cmd += config.bootNodes.enodes[i] + " ";
|
||||
}
|
||||
}
|
||||
if (config.console_toggle) {
|
||||
cmd += "console";
|
||||
}
|
||||
|
@ -105,15 +111,12 @@ Blockchain.prototype.get_address = function() {
|
|||
console.log("=== already initialized");
|
||||
address = result.output.match(/{(\w+)}/)[1];
|
||||
} else {
|
||||
console.log("running: " + this.init_command() + " " + this.account.num + " time(s)");
|
||||
result = '';
|
||||
for (var i = 0; i < this.account.num; i++){
|
||||
result = exec(this.init_command()) + '\n';
|
||||
address = result.output.match(/{(\w+)}/)[1]; //TODO: Write a proper reg expression to match multiple lines of output...not my forte
|
||||
}
|
||||
console.log("running: " + this.init_command());
|
||||
result = exec(this.init_command());
|
||||
address = result.output.match(/{(\w+)}/)[1];
|
||||
}
|
||||
}
|
||||
if (this.account.num > 1) return exec(this.list_command());
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ BlockchainConfig.prototype.config = function(env) {
|
|||
else {
|
||||
networkId = config.network_id;
|
||||
}
|
||||
|
||||
|
||||
config = {
|
||||
rpcHost: config.rpc_host,
|
||||
|
@ -41,9 +42,10 @@ BlockchainConfig.prototype.config = function(env) {
|
|||
genesisBlock: config.genesis_block,
|
||||
datadir: config.datadir,
|
||||
chains: config.chains,
|
||||
bootNodes: config.bootnodes,
|
||||
deployTimeout: config.deploy_timeout || 20,
|
||||
networkId: networkId,
|
||||
maxPeers: 4,
|
||||
maxPeers: config.max_peers || 4,
|
||||
port: config.port || "30303",
|
||||
console_toggle: config.console || false,
|
||||
mine_when_needed: config.mine_when_needed || false,
|
||||
|
@ -54,4 +56,4 @@ BlockchainConfig.prototype.config = function(env) {
|
|||
return config;
|
||||
};
|
||||
|
||||
module.exports = BlockchainConfig;
|
||||
module.exports = BlockchainConfig;
|
||||
|
|
Loading…
Reference in New Issue