mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add -p/--port option to override listening port
This commit is contained in:
parent
f1377fa217
commit
af736c98f2
@ -66,4 +66,4 @@ For more open-source projects from IBM, head over [here](http://ibm.github.io).
|
|||||||
|
|
||||||
## Copyright and license
|
## Copyright and license
|
||||||
|
|
||||||
Copyright 2013, 2015 IBM Corp. under [the Apache 2.0 license](LICENSE).
|
Copyright 2013, 2016 IBM Corp. under [the Apache 2.0 license](LICENSE).
|
||||||
|
8
red.js
8
red.js
@ -35,12 +35,14 @@ var flowFile;
|
|||||||
var knownOpts = {
|
var knownOpts = {
|
||||||
"settings":[path],
|
"settings":[path],
|
||||||
"userDir":[path],
|
"userDir":[path],
|
||||||
|
"port": Number,
|
||||||
"v": Boolean,
|
"v": Boolean,
|
||||||
"help": Boolean
|
"help": Boolean
|
||||||
};
|
};
|
||||||
var shortHands = {
|
var shortHands = {
|
||||||
"s":["--settings"],
|
"s":["--settings"],
|
||||||
"u":["--userDir"],
|
"u":["--userDir"],
|
||||||
|
"p":["--port"],
|
||||||
"?":["--help"]
|
"?":["--help"]
|
||||||
};
|
};
|
||||||
nopt.invalidHandler = function(k,v,t) {
|
nopt.invalidHandler = function(k,v,t) {
|
||||||
@ -51,11 +53,13 @@ var parsedArgs = nopt(knownOpts,shortHands,process.argv,2)
|
|||||||
|
|
||||||
if (parsedArgs.help) {
|
if (parsedArgs.help) {
|
||||||
console.log("Node-RED v"+RED.version());
|
console.log("Node-RED v"+RED.version());
|
||||||
console.log("Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR] [flows.json]");
|
console.log("Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR]");
|
||||||
|
console.log(" [--port PORT] [flows.json]");
|
||||||
console.log("");
|
console.log("");
|
||||||
console.log("Options:");
|
console.log("Options:");
|
||||||
console.log(" -s, --settings FILE use specified settings file");
|
console.log(" -s, --settings FILE use specified settings file");
|
||||||
console.log(" -u, --userDir DIR use specified user directory");
|
console.log(" -u, --userDir DIR use specified user directory");
|
||||||
|
console.log(" -p, --port PORT port to listen on");
|
||||||
console.log(" -v enable verbose output");
|
console.log(" -v enable verbose output");
|
||||||
console.log(" -?, --help show usage");
|
console.log(" -?, --help show usage");
|
||||||
console.log("");
|
console.log("");
|
||||||
@ -153,7 +157,7 @@ if (settings.httpNodeRoot !== false) {
|
|||||||
settings.httpNodeAuth = settings.httpNodeAuth || settings.httpAuth;
|
settings.httpNodeAuth = settings.httpNodeAuth || settings.httpAuth;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.uiPort = settings.uiPort||1880;
|
settings.uiPort = parsedArgs.port||settings.uiPort||1880;
|
||||||
settings.uiHost = settings.uiHost||"0.0.0.0";
|
settings.uiHost = settings.uiHost||"0.0.0.0";
|
||||||
|
|
||||||
if (flowFile) {
|
if (flowFile) {
|
||||||
|
Loading…
Reference in New Issue
Block a user