simplify server websocket configuration
parent
31ec784de6
commit
2dfbb522b0
|
@ -17,9 +17,6 @@ sedeasy() {
|
|||
}
|
||||
|
||||
# Configure
|
||||
[ -n "$USE_SSL" ] && echo "Using secure websockets: $USE_SSL" \
|
||||
&& sedeasy "useSecureWebsockets: [^,]*," "useSecureWebsockets: ${USE_SSL}," cfg/config.js
|
||||
|
||||
[ -n "$STORAGE" ] && echo "Using storage adapter: $STORAGE" \
|
||||
&& sedeasy "storage: [^,]*," "storage: ${STORAGE}," cfg/config.js
|
||||
|
||||
|
|
10
server.js
10
server.js
|
@ -13,9 +13,6 @@ var nThen = require("nthen");
|
|||
|
||||
var config = require("./lib/load-config");
|
||||
|
||||
var websocketPort = config.websocketPort || config.httpPort;
|
||||
var useSecureWebsockets = config.useSecureWebsockets || false;
|
||||
|
||||
// This is stuff which will become available to replify
|
||||
const debuggableStore = new WeakMap();
|
||||
const debuggable = function (name, x) {
|
||||
|
@ -211,9 +208,6 @@ app.get('/api/config', function(req, res){
|
|||
removeDonateButton: (config.removeDonateButton === true),
|
||||
allowSubscriptions: (config.allowSubscriptions === true),
|
||||
websocketPath: config.useExternalWebsocket ? undefined : config.websocketPath,
|
||||
// FIXME don't send websocketURL if websocketPath is provided. deprecated.
|
||||
websocketURL:'ws' + ((useSecureWebsockets) ? 's' : '') + '://' + host + ':' +
|
||||
websocketPort + '/cryptpad_websocket',
|
||||
httpUnsafeOrigin: config.httpUnsafeOrigin.replace(/^\s*/, ''),
|
||||
adminEmail: config.adminEmail,
|
||||
adminKeys: admins,
|
||||
|
@ -327,10 +321,6 @@ var nt = nThen(function (w) {
|
|||
historyKeeper = HK.create(hkConfig);
|
||||
}).nThen(function () {
|
||||
if (config.useExternalWebsocket) { return; }
|
||||
if (websocketPort !== config.httpPort) {
|
||||
log.debug("setting up a new websocket server");
|
||||
wsConfig = { port: websocketPort};
|
||||
}
|
||||
var wsSrv = new WebSocketServer(wsConfig);
|
||||
NetfluxSrv.run(wsSrv, config, historyKeeper);
|
||||
});
|
||||
|
|
|
@ -4,7 +4,6 @@ define([
|
|||
var Config = {};
|
||||
|
||||
Config.getWebsocketURL = function (origin) {
|
||||
if (!ApiConfig.websocketPath) { return ApiConfig.websocketURL; }
|
||||
var path = ApiConfig.websocketPath;
|
||||
if (/^ws{1,2}:\/\//.test(path)) { return path; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue