mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Widen support for env var to use ${} or $() syntax
This commit is contained in:
@@ -35,10 +35,17 @@ describe('flows/util', function() {
|
||||
});
|
||||
|
||||
describe('#mapEnvVarProperties',function() {
|
||||
it('handles ENV substitutions in an object', function() {
|
||||
before(function() {
|
||||
process.env.foo1 = "bar1";
|
||||
process.env.foo2 = "bar2";
|
||||
process.env.foo3 = "bar3";
|
||||
})
|
||||
after(function() {
|
||||
delete process.env.foo1;
|
||||
delete process.env.foo2;
|
||||
delete process.env.foo3;
|
||||
})
|
||||
it('handles ENV substitutions in an object - $()', function() {
|
||||
var foo = {a:"$(foo1)",b:"$(foo2)",c:{d:"$(foo3)"}};
|
||||
for (var p in foo) {
|
||||
if (foo.hasOwnProperty(p)) {
|
||||
@@ -47,6 +54,15 @@ describe('flows/util', function() {
|
||||
}
|
||||
foo.should.eql({ a: 'bar1', b: 'bar2', c: { d: 'bar3' } } );
|
||||
});
|
||||
it('handles ENV substitutions in an object - ${}', function() {
|
||||
var foo = {a:"${foo1}",b:"${foo2}",c:{d:"${foo3}"}};
|
||||
for (var p in foo) {
|
||||
if (foo.hasOwnProperty(p)) {
|
||||
flowUtil.mapEnvVarProperties(foo,p);
|
||||
}
|
||||
}
|
||||
foo.should.eql({ a: 'bar1', b: 'bar2', c: { d: 'bar3' } } );
|
||||
});
|
||||
});
|
||||
|
||||
describe('#diffNodes',function() {
|
||||
|
Reference in New Issue
Block a user