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

Assume -d params are strings if they don't otherwise parse

This commit is contained in:
Nick O'Leary 2020-06-04 00:04:41 +01:00
parent c0f4e07e10
commit c8f6100a6a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -153,7 +153,12 @@ if (parsedArgs.define) {
var match = /^(([^=]+)=(.+)|@(.*))$/.exec(def); var match = /^(([^=]+)=(.+)|@(.*))$/.exec(def);
if (match) { if (match) {
if (!match[4]) { if (!match[4]) {
var val = JSON.parse(match[3]); var val = match[3];
try {
val = JSON.parse(match[3]);
} catch(err) {
// Leave it as a string
}
RED.util.setObjectProperty(settings, match[2], val, true); RED.util.setObjectProperty(settings, match[2], val, true);
} else { } else {
var obj = fs.readJsonSync(match[4]); var obj = fs.readJsonSync(match[4]);