Add node-red admin support

This commit is contained in:
Nick O'Leary 2020-06-02 23:39:36 +01:00
parent 6d737b9e4c
commit 3e74d75f28
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 14 additions and 0 deletions

View File

@ -56,6 +56,7 @@
"mqtt": "2.18.8",
"multer": "1.4.2",
"mustache": "4.0.1",
"node-red-admin": "^0.2.2",
"node-red-node-rbe": "^0.2.6",
"node-red-node-sentiment": "^0.1.6",
"node-red-node-tail": "^0.1.0",

View File

@ -39,6 +39,7 @@
"bcryptjs": "2.4.3",
"express": "4.17.1",
"fs-extra": "8.1.0",
"node-red-admin": "^0.2.2",
"node-red-node-rbe": "^0.2.6",
"node-red-node-tail": "^0.1.0",
"nopt": "4.0.3",

View File

@ -14,6 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
if (process.argv[2] === 'admin') {
try {
require("node-red-admin")(process.argv.slice(3))
} catch(err) {
console.log(err)
}
return;
}
var http = require('http');
var https = require('https');
var util = require("util");
@ -63,6 +73,7 @@ if (parsedArgs.help) {
console.log("Node-RED v"+RED.version());
console.log("Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR]");
console.log(" [--port PORT] [--title TITLE] [--safe] [flows.json]");
console.log(" node-red admin <command> [args] [-?] [--userDir DIR] [--json]");
console.log("");
console.log("Options:");
console.log(" -p, --port PORT port to listen on");
@ -73,6 +84,7 @@ if (parsedArgs.help) {
console.log(" --safe enable safe mode");
console.log(" -D, --define X=Y overwrite value in settings file");
console.log(" -?, --help show this help");
console.log(" admin <command> run an admin command");
console.log("");
console.log("Documentation can be found at http://nodered.org");
process.exit();