mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
extract method for determing network type
This commit is contained in:
parent
d67982ac71
commit
b29f23e28c
@ -1,4 +1,5 @@
|
||||
|
||||
// TODO: make all of this async
|
||||
var GethCommands = function(options) {
|
||||
this.config = options.config;
|
||||
this.env = options.env || 'development';
|
||||
@ -10,13 +11,7 @@ GethCommands.prototype.commonOptions = function() {
|
||||
var config = this.config;
|
||||
var cmd = "";
|
||||
|
||||
if (config.networkType === 'testnet') {
|
||||
cmd += "--testnet ";
|
||||
} else if (config.networkType === 'olympic') {
|
||||
cmd += "--olympic ";
|
||||
} else if (config.networkType === 'custom') {
|
||||
cmd += "--networkid " + config.networkId + " ";
|
||||
}
|
||||
cmd += this.determineNetworkType(config);
|
||||
|
||||
if (config.datadir) {
|
||||
cmd += "--datadir=\"" + config.datadir + "\" ";
|
||||
@ -37,6 +32,18 @@ GethCommands.prototype.commonOptions = function() {
|
||||
return cmd;
|
||||
};
|
||||
|
||||
GethCommands.prototype.determineNetworkType = function(config) {
|
||||
var cmd = "";
|
||||
if (config.networkType === 'testnet') {
|
||||
cmd += "--testnet ";
|
||||
} else if (config.networkType === 'olympic') {
|
||||
cmd += "--olympic ";
|
||||
} else if (config.networkType === 'custom') {
|
||||
cmd += "--networkid " + config.networkId + " ";
|
||||
}
|
||||
return cmd;
|
||||
};
|
||||
|
||||
GethCommands.prototype.initGenesisCommmand = function() {
|
||||
var config = this.config;
|
||||
var cmd = this.geth_bin + " " + this.commonOptions();
|
||||
|
Loading…
x
Reference in New Issue
Block a user