default to boilerplate blockchain settings

This commit is contained in:
Iuri Matias 2018-01-12 17:16:46 -05:00
parent 4ab01744c6
commit 7cac969f16
1 changed files with 12 additions and 1 deletions

View File

@ -4,12 +4,16 @@ var fs = require('../../core/fs.js');
var GethCommands = require('./geth_commands.js');
/*eslint complexity: ["error", 26]*/
/*eslint complexity: ["error", 30]*/
var Blockchain = function(options) {
this.blockchainConfig = options.blockchainConfig;
this.env = options.env || 'development';
this.client = options.client;
if ((this.blockchainConfig === {} || JSON.stringify(this.blockchainConfig) === '{"enabled":true}') && this.env !== 'development') {
console.log("===> warning: running default config on a non-development environment");
}
this.config = {
geth_bin: this.blockchainConfig.geth_bin || 'geth',
networkType: this.blockchainConfig.networkType || 'custom',
@ -36,6 +40,13 @@ var Blockchain = function(options) {
vmdebug: this.blockchainConfig.vmdebug || false
};
if (this.blockchainConfig === {} || JSON.stringify(this.blockchainConfig) === '{"enabled":true}') {
this.config.account = {};
this.config.account.password = fs.embarkPath("boilerplate/config/development/password");
this.config.genesisBlock = fs.embarkPath("boilerplate/config/development/genesis.json");
this.config.datadir = fs.embarkPath(".embark/development/datadir");
}
this.client = new options.client({config: this.config, env: this.env});
};