When communication is disabled in config, do not run the module in embark.

Previous to this change, `Geth: WARN [06-25|16:46:26] origin 'embark' not allowed on WS-RPC interface` would appear in the logs when the module was run while disabled.

Updated the cors component so that when `rpcCorsDomain` and `wsOrigins` are set to `'auto'`, and all components are disabled `rpcCorsDomain` and `wsOrigins` are passed as a null parameter to geth as opposed to being passed as `'auto'`.
This commit is contained in:
emizzle 2018-06-26 13:34:52 +10:00
parent 0ba5f1a1b3
commit d32708fcde
2 changed files with 12 additions and 2 deletions

View File

@ -119,8 +119,14 @@ Config.prototype._updateBlockchainCors = function(){
} }
let cors = corsParts.join(','); let cors = corsParts.join(',');
if(blockchainConfig.rpcCorsDomain === 'auto' && cors.length) blockchainConfig.rpcCorsDomain = cors; if(blockchainConfig.rpcCorsDomain === 'auto'){
if(blockchainConfig.wsOrigins === 'auto' && cors.length) blockchainConfig.wsOrigins = cors; if(cors.length) blockchainConfig.rpcCorsDomain = cors;
else blockchainConfig.rpcCorsDomain = '';
}
if(blockchainConfig.wsOrigins === 'auto'){
if(cors.length) blockchainConfig.wsOrigins = cors;
else blockchainConfig.wsOrigins = '';
}
}; };
Config.prototype._mergeConfig = function(configFilePath, defaultConfig, env, enabledByDefault) { Config.prototype._mergeConfig = function(configFilePath, defaultConfig, env, enabledByDefault) {

View File

@ -11,6 +11,10 @@ class Whisper {
this.web3 = new Web3(); this.web3 = new Web3();
this.embark = embark; this.embark = embark;
if (!this.communicationConfig.enabled) {
return;
}
this.connectToProvider(); this.connectToProvider();
this.setServiceCheck(); this.setServiceCheck();
this.addWhisperToEmbarkJS(); this.addWhisperToEmbarkJS();