feat(blockchainConfig): enable having auto cors plus other origins

This commit is contained in:
Jonathan Rainville 2019-01-08 16:27:34 -05:00
parent 540ff751a9
commit 9e349ff267

View File

@ -163,13 +163,15 @@ Config.prototype._updateBlockchainCors = function(){
corsParts.push(constants.embarkResourceOrigin);
let cors = corsParts.join(',');
if(blockchainConfig.rpcCorsDomain === 'auto'){
if(cors.length) blockchainConfig.rpcCorsDomain = cors;
else blockchainConfig.rpcCorsDomain = '';
if (blockchainConfig.rpcCorsDomain === 'auto') {
blockchainConfig.rpcCorsDomain = cors;
} else if (blockchainConfig.rpcCorsDomain.indexOf('auto') > -1) {
blockchainConfig.rpcCorsDomain = blockchainConfig.rpcCorsDomain.replace('auto', cors);
}
if(blockchainConfig.wsOrigins === 'auto'){
if(cors.length) blockchainConfig.wsOrigins = cors;
else blockchainConfig.wsOrigins = '';
if (blockchainConfig.wsOrigins === 'auto') {
blockchainConfig.wsOrigins = cors;
} else if (blockchainConfig.wsOrigins.indexOf('auto') > -1) {
blockchainConfig.wsOrigins = blockchainConfig.wsOrigins.replace('auto', cors);
}
};