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
1 changed files with 6 additions and 1 deletions

View File

@ -153,7 +153,12 @@ if (parsedArgs.define) {
var match = /^(([^=]+)=(.+)|@(.*))$/.exec(def);
if (match) {
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);
} else {
var obj = fs.readJsonSync(match[4]);