1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

When creating 'redserver' for a node, use runtime.server rather than runtime.adminApi.server, and fill runtime.server at startup with the valid http server regardless of adminApi being available.

This resolves websockets not working when the adminApi (httpAdminRoot) is disabled in settings.
This commit is contained in:
Simon Hailes 2017-12-20 16:04:32 +00:00
parent 256e5360d4
commit 6696b6661a
2 changed files with 10 additions and 2 deletions

View File

@ -69,13 +69,21 @@ module.exports = {
runtime.init(userSettings,api);
api.init(httpServer,runtime);
apiEnabled = true;
server = runtime.adminApi.server;
runtime.server = runtime.adminApi.server;
} else {
runtime.init(userSettings);
apiEnabled = false;
if (httpServer){
server = httpServer;
runtime.server = httpServer;
} else {
server = runtime.adminApi.server;
runtime.server = runtime.adminApi.server; // useless at this point, but at least harmless.
}
}
adminApp = runtime.adminApi.adminApp;
nodeApp = runtime.nodeApp;
server = runtime.adminApi.server;
return;
},
start: function() {

View File

@ -84,7 +84,7 @@ function createNodeApi(node) {
red.auth = runtime.adminApi.auth;
red.httpAdmin = runtime.adminApi.adminApp;
red.httpNode = runtime.nodeApp;
red.server = runtime.adminApi.server;
red.server = runtime.server;
} else {
//TODO: runtime.adminApi is always stubbed if not enabled, so this block
// is unused - but may be needed for the unit tests