diff --git a/lib/core/config.js b/lib/core/config.js index 3ca8fda6..13372037 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -123,11 +123,11 @@ Config.prototype._updateBlockchainCors = function(){ } let cors = corsParts.join(','); - if(blockchainConfig.rpcCorsDomain === 'auto'){ + if(blockchainConfig.rpcCorsDomain === 'auto'){ if(cors.length) blockchainConfig.rpcCorsDomain = cors; else blockchainConfig.rpcCorsDomain = ''; } - if(blockchainConfig.wsOrigins === 'auto'){ + if(blockchainConfig.wsOrigins === 'auto'){ if(cors.length) blockchainConfig.wsOrigins = cors; else blockchainConfig.wsOrigins = ''; } diff --git a/lib/core/processes/processLauncher.js b/lib/core/processes/processLauncher.js index 1bbf9153..7ee80fc5 100644 --- a/lib/core/processes/processLauncher.js +++ b/lib/core/processes/processLauncher.js @@ -3,6 +3,7 @@ const constants = require('../../constants'); const path = require('path'); const utils = require('../../utils/utils'); +let processCount = 1; class ProcessLauncher { /** @@ -15,7 +16,14 @@ class ProcessLauncher { */ constructor(options) { this.name = path.basename(options.modulePath); - this.process = child_process.fork(options.modulePath); + + if (this._isDebug()) { + const childOptions = {stdio: 'pipe', execArgv: ['--inspect-brk=' + (60000 + processCount)]}; + processCount++; + this.process = child_process.fork(options.modulePath, [], childOptions); + } else { + this.process = child_process.fork(options.modulePath); + } this.logger = options.logger; this.events = options.events; this.silent = options.silent; @@ -25,6 +33,11 @@ class ProcessLauncher { this._subscribeToMessages(); } + _isDebug() { + const argvString= process.execArgv.join(); + return argvString.includes('--debug') || argvString.includes('--inspect'); + } + // Subscribes to messages from the child process and delegates to the right methods _subscribeToMessages() { const self = this; diff --git a/lib/modules/blockchain_connector/index.js b/lib/modules/blockchain_connector/index.js index 5142234e..6d812ef5 100644 --- a/lib/modules/blockchain_connector/index.js +++ b/lib/modules/blockchain_connector/index.js @@ -82,7 +82,7 @@ class BlockchainConnector { if (!networkId && constants.blockchain.networkIds[self.blockchainConfig.networkType]) { networkId = constants.blockchain.networkIds[self.blockchainConfig.networkType]; } - if (id.toString() !== networkId.toString()) { + if (networkId && id.toString() !== networkId.toString()) { self.logger.warn(__('Connected to a blockchain node on network {{realId}} while your config specifies {{configId}}', {realId: id, configId: networkId})); self.logger.warn(__('Make sure you started the right blockchain node')); } diff --git a/lib/modules/blockchain_process/blockchain.js b/lib/modules/blockchain_process/blockchain.js index c50c237b..65bb92e4 100644 --- a/lib/modules/blockchain_process/blockchain.js +++ b/lib/modules/blockchain_process/blockchain.js @@ -155,7 +155,7 @@ Blockchain.prototype.run = function() { } ], function (err, cmd, args) { if (err) { - console.error(err); + console.error(err.message); return; } args = utils.compact(args); diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 4d0bf70b..e93abb9e 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -217,11 +217,7 @@ class ENS { "ENS": { "deploy": false, "silent": true - } - } - }, - "development": { - "contracts": { + }, "ENSRegistry": { "deploy": true, "silent": true, @@ -285,7 +281,7 @@ class ENS { if (this.registration && this.registration.rootDomain) { // Register root domain if it is defined const rootNode = namehash.hash(this.registration.rootDomain); - config.development.contracts['FIFSRegistrar'] = { + config.default.contracts['FIFSRegistrar'] = { "deploy": true, "silent": true, "args": ["$ENSRegistry", rootNode],