You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by vv...@apache.org on 2018/08/14 16:02:00 UTC

[incubator-openwhisk-runtime-nodejs] branch master updated: update run handler to accept more environment variables (#78)

This is an automated email from the ASF dual-hosted git repository.

vvraskin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-runtime-nodejs.git


The following commit(s) were added to refs/heads/master by this push:
     new fa10c58  update run handler to accept more environment variables (#78)
fa10c58 is described below

commit fa10c583241b133817a648d9f1310f2631de8435
Author: Carlos Santana <cs...@apache.org>
AuthorDate: Tue Aug 14 12:01:58 2018 -0400

    update run handler to accept more environment variables (#78)
---
 core/nodejsActionBase/src/service.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/core/nodejsActionBase/src/service.js b/core/nodejsActionBase/src/service.js
index daf365f..eb99b6e 100644
--- a/core/nodejsActionBase/src/service.js
+++ b/core/nodejsActionBase/src/service.js
@@ -156,12 +156,14 @@ function NodeActionService(config) {
     }
 
     function doRun(req) {
-        var msg = req.body || {};
-
-        var props = [ 'api_key', 'namespace', 'action_name', 'activation_id', 'deadline' ];
-        props.map(function (p) {
-            process.env['__OW_' + p.toUpperCase()] = msg[p];
-        });
+        var msg = req && req.body || {};
+        Object.keys(msg).forEach(
+            function (k) {
+                if(typeof msg[k] === 'string' && k !== 'value'){
+                    process.env['__OW_' + k.toUpperCase()] = msg[k];
+                }
+            }
+        );
 
         return userCodeRunner.run(msg.value).then(function(result) {
             if (typeof result !== "object") {