Allow zero config in blockchain
This commit is contained in:
parent
fa551f67a3
commit
23f7ec396a
|
@ -3,6 +3,7 @@ const constants = require('../../constants');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const utils = require('../../utils/utils');
|
const utils = require('../../utils/utils');
|
||||||
|
|
||||||
|
let processCount = 1;
|
||||||
class ProcessLauncher {
|
class ProcessLauncher {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +16,14 @@ class ProcessLauncher {
|
||||||
*/
|
*/
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.name = path.basename(options.modulePath);
|
this.name = path.basename(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.process = child_process.fork(options.modulePath);
|
||||||
|
}
|
||||||
this.logger = options.logger;
|
this.logger = options.logger;
|
||||||
this.events = options.events;
|
this.events = options.events;
|
||||||
this.silent = options.silent;
|
this.silent = options.silent;
|
||||||
|
@ -25,6 +33,11 @@ class ProcessLauncher {
|
||||||
this._subscribeToMessages();
|
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
|
// Subscribes to messages from the child process and delegates to the right methods
|
||||||
_subscribeToMessages() {
|
_subscribeToMessages() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
|
@ -82,7 +82,7 @@ class BlockchainConnector {
|
||||||
if (!networkId && constants.blockchain.networkIds[self.blockchainConfig.networkType]) {
|
if (!networkId && constants.blockchain.networkIds[self.blockchainConfig.networkType]) {
|
||||||
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(__('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'));
|
self.logger.warn(__('Make sure you started the right blockchain node'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ Blockchain.prototype.run = function() {
|
||||||
}
|
}
|
||||||
], function (err, cmd, args) {
|
], function (err, cmd, args) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args = utils.compact(args);
|
args = utils.compact(args);
|
||||||
|
|
|
@ -217,11 +217,7 @@ class ENS {
|
||||||
"ENS": {
|
"ENS": {
|
||||||
"deploy": false,
|
"deploy": false,
|
||||||
"silent": true
|
"silent": true
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"development": {
|
|
||||||
"contracts": {
|
|
||||||
"ENSRegistry": {
|
"ENSRegistry": {
|
||||||
"deploy": true,
|
"deploy": true,
|
||||||
"silent": true,
|
"silent": true,
|
||||||
|
@ -285,7 +281,7 @@ class ENS {
|
||||||
if (this.registration && this.registration.rootDomain) {
|
if (this.registration && this.registration.rootDomain) {
|
||||||
// Register root domain if it is defined
|
// Register root domain if it is defined
|
||||||
const rootNode = namehash.hash(this.registration.rootDomain);
|
const rootNode = namehash.hash(this.registration.rootDomain);
|
||||||
config.development.contracts['FIFSRegistrar'] = {
|
config.default.contracts['FIFSRegistrar'] = {
|
||||||
"deploy": true,
|
"deploy": true,
|
||||||
"silent": true,
|
"silent": true,
|
||||||
"args": ["$ENSRegistry", rootNode],
|
"args": ["$ENSRegistry", rootNode],
|
||||||
|
|
Loading…
Reference in New Issue