Merge pull request #581 from embark-framework/bug_fix/whisper-cors

When communication is disabled in config, do not run the module in em…
This commit is contained in:
Iuri Matias 2018-06-26 16:23:06 -04:00 committed by GitHub
commit 88132b7b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -119,8 +119,14 @@ Config.prototype._updateBlockchainCors = function(){
}
let cors = corsParts.join(',');
if(blockchainConfig.rpcCorsDomain === 'auto' && cors.length) blockchainConfig.rpcCorsDomain = cors;
if(blockchainConfig.wsOrigins === 'auto' && cors.length) blockchainConfig.wsOrigins = cors;
if(blockchainConfig.rpcCorsDomain === 'auto'){
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) {

View File

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