mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add settings.uiHost - to allow binding to a specific interface
Closes #58
This commit is contained in:
parent
cb6fbf29a8
commit
a2e77471a9
11
red.js
11
red.js
@ -39,6 +39,7 @@ if (settings.httpRoot.slice(-1) != "/") {
|
||||
settings.httpRoot = settings.httpRoot + "/";
|
||||
}
|
||||
settings.uiPort = settings.uiPort||1880;
|
||||
settings.uiHost = settings.uiHost||"0.0.0.0";
|
||||
|
||||
if (settings.httpAuth) {
|
||||
app.use(settings.httpRoot,
|
||||
@ -55,13 +56,17 @@ app.use(settings.httpRoot,red);
|
||||
|
||||
RED.start();
|
||||
|
||||
server.listen(settings.uiPort,function() {
|
||||
util.log('[red] Server now running at http'+(settings.https?'s':'')+'://127.0.0.1:'+settings.uiPort+settings.httpRoot);
|
||||
var listenPath = 'http'+(settings.https?'s':'')+'://'+
|
||||
(settings.uiHost == '0.0.0.0'?'127.0.0.1':settings.uiHost)+
|
||||
':'+settings.uiPort+settings.httpRoot;
|
||||
|
||||
server.listen(settings.uiPort,settings.uiHost,function() {
|
||||
util.log('[red] Server now running at '+listenPath);
|
||||
});
|
||||
|
||||
process.on('uncaughtException',function(err) {
|
||||
if (err.errno === "EADDRINUSE") {
|
||||
util.log('[red] Unable to listen on http'+(settings.https?'s':'')+'://127.0.0.1:'+settings.uiPort+settings.httpRoot);
|
||||
util.log('[red] Unable to listen on '+listenPath);
|
||||
util.log('[red] Error: port in use');
|
||||
} else {
|
||||
util.log('[red] Uncaught Exception:');
|
||||
|
@ -15,6 +15,12 @@
|
||||
**/
|
||||
module.exports = {
|
||||
uiPort: 1880,
|
||||
|
||||
// By default, the Node-RED UI accepts connections on all IPv4 interfaces.
|
||||
// The following property can be used to listen on a specific interface. For
|
||||
// example, the following would only allow connections from the local machine.
|
||||
//uiHost: "127.0.0.1",
|
||||
|
||||
mqttReconnectTime: 15000,
|
||||
serialReconnectTime: 15000,
|
||||
debugMaxLength: 1000,
|
||||
|
Loading…
Reference in New Issue
Block a user