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

Validate fields that are $(env-vars)

Closes #825
This commit is contained in:
Nick O'Leary 2016-03-13 14:29:36 +00:00
parent 12c4561aba
commit 37d4a6b9e2

View File

@ -1,5 +1,5 @@
/**
* Copyright 2013, 2015 IBM Corp.
* Copyright 2013, 2016 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -116,6 +116,9 @@ RED.editor = (function() {
*/
function validateNodeProperty(node,definition,property,value) {
var valid = true;
if (/^\$\([a-zA-Z_][a-zA-Z0-9_]*\)$/.test(value)) {
return true;
}
if ("required" in definition[property] && definition[property].required) {
valid = value !== "";
}