mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add env.get to Function node
This commit is contained in:
@@ -53,12 +53,14 @@
|
||||
<p>The Catch node can also be used to handle errors. To invoke a Catch node,
|
||||
pass <code>msg</code> as a second argument to <code>node.error</code>:</p>
|
||||
<pre>node.error("Error",msg);</pre>
|
||||
<h4>Referring Node Information</h4>
|
||||
<h4>Accessing Node Information</h4>
|
||||
<p>In the function block, id and name of the node can be referenced using the following properties:</p>
|
||||
<ul>
|
||||
<li><code>node.id</code> - id of the node</li>
|
||||
<li><code>node.name</code> - name of the node</li>
|
||||
</ul>
|
||||
<h4>Using environment variables</h4>
|
||||
<p>Environment variables can be accessed using <code>env.get("MY_ENV_VAR")</code>.</p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@@ -156,6 +156,13 @@ module.exports = function(RED) {
|
||||
return node.context().global.keys.apply(node,arguments);
|
||||
}
|
||||
},
|
||||
env: {
|
||||
get: function(envVar) {
|
||||
// For now, just return the env var. This will eventually
|
||||
// also return project settings and subflow instance properties
|
||||
return process.env[envVar]
|
||||
}
|
||||
},
|
||||
setTimeout: function () {
|
||||
var func = arguments[0];
|
||||
var timerId;
|
||||
|
Reference in New Issue
Block a user