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:
parent
256e5360d4
commit
6696b6661a
10
red/red.js
10
red/red.js
@ -69,13 +69,21 @@ module.exports = {
|
|||||||
runtime.init(userSettings,api);
|
runtime.init(userSettings,api);
|
||||||
api.init(httpServer,runtime);
|
api.init(httpServer,runtime);
|
||||||
apiEnabled = true;
|
apiEnabled = true;
|
||||||
|
server = runtime.adminApi.server;
|
||||||
|
runtime.server = runtime.adminApi.server;
|
||||||
} else {
|
} else {
|
||||||
runtime.init(userSettings);
|
runtime.init(userSettings);
|
||||||
apiEnabled = false;
|
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;
|
adminApp = runtime.adminApi.adminApp;
|
||||||
nodeApp = runtime.nodeApp;
|
nodeApp = runtime.nodeApp;
|
||||||
server = runtime.adminApi.server;
|
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
|
@ -84,7 +84,7 @@ function createNodeApi(node) {
|
|||||||
red.auth = runtime.adminApi.auth;
|
red.auth = runtime.adminApi.auth;
|
||||||
red.httpAdmin = runtime.adminApi.adminApp;
|
red.httpAdmin = runtime.adminApi.adminApp;
|
||||||
red.httpNode = runtime.nodeApp;
|
red.httpNode = runtime.nodeApp;
|
||||||
red.server = runtime.adminApi.server;
|
red.server = runtime.server;
|
||||||
} else {
|
} else {
|
||||||
//TODO: runtime.adminApi is always stubbed if not enabled, so this block
|
//TODO: runtime.adminApi is always stubbed if not enabled, so this block
|
||||||
// is unused - but may be needed for the unit tests
|
// is unused - but may be needed for the unit tests
|
||||||
|
Loading…
Reference in New Issue
Block a user