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

add --credentialSecret -k to command-line options

This commit is contained in:
Dave Conway-Jones 2018-04-05 14:48:47 +01:00
parent 499d22daca
commit 7a8906535e
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

10
red.js
View File

@ -33,6 +33,7 @@ var settingsFile;
var flowFile; var flowFile;
var knownOpts = { var knownOpts = {
"credentialSecret": String,
"help": Boolean, "help": Boolean,
"port": Number, "port": Number,
"settings": [path], "settings": [path],
@ -41,6 +42,7 @@ var knownOpts = {
"verbose": Boolean "verbose": Boolean
}; };
var shortHands = { var shortHands = {
"k":["--credentialSecret"],
"?":["--help"], "?":["--help"],
"p":["--port"], "p":["--port"],
"s":["--settings"], "s":["--settings"],
@ -59,9 +61,11 @@ 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]"); console.log("Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR]");
console.log(" [--port PORT] [--title TITLE] [flows.json]"); console.log(" [--port PORT] [--credentialSecret SECRET_KEY]");
console.log(" [--title TITLE] [flows.json]");
console.log(""); console.log("");
console.log("Options:"); console.log("Options:");
console.log(" -k, --credentialSecret SECRET_KEY key to unlock credentials file");
console.log(" -p, --port PORT port to listen on"); console.log(" -p, --port PORT port to listen on");
console.log(" -s, --settings FILE use specified settings file"); console.log(" -s, --settings FILE use specified settings file");
console.log(" --title TITLE process window title"); console.log(" --title TITLE process window title");
@ -126,6 +130,10 @@ try {
process.exit(); process.exit();
} }
if (parsedArgs.credentialSecret) {
settings.credentialSecret = parsedArgs.credentialSecret;
}
if (parsedArgs.verbose) { if (parsedArgs.verbose) {
settings.verbose = true; settings.verbose = true;
} }