Merge pull request #735 from embark-framework/bugfix/allow-zero-config-blockchain
Allow zero config in blockchain
This commit is contained in:
commit
7eb52c1f8f
|
@ -187,6 +187,12 @@ Config.prototype.loadBlockchainConfigFile = function() {
|
||||||
if (!configFilePath) {
|
if (!configFilePath) {
|
||||||
this.blockchainConfig.default = true;
|
this.blockchainConfig.default = true;
|
||||||
}
|
}
|
||||||
|
if(!this.blockchainConfig.account && !this.blockchainConfig.isDev) {
|
||||||
|
this.logger.warn(
|
||||||
|
__('Account settings are needed for this chain.' +
|
||||||
|
' Please put a valid address and possibly a password in your blockchain config or use a dev chain.')
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Config.prototype.loadContractsConfigFile = function() {
|
Config.prototype.loadContractsConfigFile = function() {
|
||||||
|
|
|
@ -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