mirror of https://github.com/embarklabs/embark.git
storage procs launcher -- canonicalHost
This commit is contained in:
parent
3885128e18
commit
ca7a46224d
|
@ -4,6 +4,7 @@ const utils = require('../../utils/utils');
|
|||
const ProcessLauncher = require('../../process/processLauncher');
|
||||
const constants = require('../../constants');
|
||||
const StorageUtils = require('./storageUtils');
|
||||
const {canonicalHost} = require('../../utils/host');
|
||||
|
||||
class StorageProcessesLauncher {
|
||||
constructor(options) {
|
||||
|
@ -46,6 +47,9 @@ class StorageProcessesLauncher {
|
|||
// remove /ipfs or /bzz: from getUrl if it's there
|
||||
let getUrlParts = dappConn.getUrl.split('/');
|
||||
getUrlParts = getUrlParts.slice(0, 3);
|
||||
let host = canonicalHost(getUrlParts[2].split(':')[0]);
|
||||
let port = getUrlParts[2].split(':')[1];
|
||||
getUrlParts[2] = port ? [host, port].join(':') : host;
|
||||
corsParts.push(getUrlParts.join('/'));
|
||||
}
|
||||
// in case getUrl wasn't specified, use a built url
|
||||
|
@ -59,12 +63,12 @@ class StorageProcessesLauncher {
|
|||
if(this.blockchainConfig.enabled) {
|
||||
// add our rpc endpoints to CORS
|
||||
if(this.blockchainConfig.rpcHost && this.blockchainConfig.rpcPort){
|
||||
corsParts.push(`http://${this.blockchainConfig.rpcHost}:${this.blockchainConfig.rpcPort}`);
|
||||
corsParts.push(`http://${canonicalHost(this.blockchainConfig.rpcHost)}:${this.blockchainConfig.rpcPort}`);
|
||||
}
|
||||
|
||||
// add our ws endpoints to CORS
|
||||
if(this.blockchainConfig.wsRPC && this.blockchainConfig.wsHost && this.blockchainConfig.wsPort){
|
||||
corsParts.push(`ws://${this.blockchainConfig.wsHost}:${this.blockchainConfig.wsPort}`);
|
||||
corsParts.push(`ws://${canonicalHost(this.blockchainConfig.wsHost)}:${this.blockchainConfig.wsPort}`);
|
||||
}
|
||||
}
|
||||
return corsParts;
|
||||
|
|
Loading…
Reference in New Issue