From 7cac969f16587c6730493efe678741565d96dc91 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 12 Jan 2018 17:16:46 -0500 Subject: [PATCH] default to boilerplate blockchain settings --- lib/cmds/blockchain/blockchain.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/cmds/blockchain/blockchain.js b/lib/cmds/blockchain/blockchain.js index 5ac8981f..524cba5a 100644 --- a/lib/cmds/blockchain/blockchain.js +++ b/lib/cmds/blockchain/blockchain.js @@ -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}); };