Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export var getGlobalConfig = function() {
return {
wsHost: Defaults.host,
wsPort: Defaults.ws_port,
wssPort: Defaults.wss_port,
httpHost: Defaults.sockjs_host,
httpPort: Defaults.sockjs_http_port,
httpsPort: Defaults.sockjs_https_port,
httpPath: Defaults.sockjs_path,
statsHost: Defaults.stats_host,
authEndpoint: Defaults.channel_auth_endpoint,
authTransport: Defaults.channel_auth_transport,
// TODO make this consistent with other options in next major version
activity_timeout: Defaults.activity_timeout,
pong_timeout: Defaults.pong_timeout,
unavailable_timeout: Defaults.unavailable_timeout
};
};
set host(val) {
if (!_.isString(val) || !val.length) {
this[$host] = defaults.host;
return;
}
val = val.replace(/^https?:\/\//, '');
const url = urlUtil.parse(`http://${ val }`);
this[$host] = url.hostname || defaults.host;
if (url.port) this.port = url.port;
}
set host(val) {
if (!_.isString(val) || !val.length) {
this[$host] = defaults.host;
return;
}
val = val.replace(/^https?:\/\//, '');
const url = urlUtil.parse(`http://${ val }`);
this[$host] = url.hostname || defaults.host;
if (url.port) this.port = url.port;
}