You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/08/14 13:51:02 UTC

[GitHub] vvraskin closed pull request #7: remove hardcoded env variables for run handler

vvraskin closed pull request #7: remove hardcoded env variables for run handler
URL: https://github.com/apache/incubator-openwhisk-runtime-ballerina/pull/7
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ballerina/proxy/src/main/java/org/ballerinalang/openwhisk/runtime/BallerinaProxy.java b/ballerina/proxy/src/main/java/org/ballerinalang/openwhisk/runtime/BallerinaProxy.java
index f03366e..1734ad0 100644
--- a/ballerina/proxy/src/main/java/org/ballerinalang/openwhisk/runtime/BallerinaProxy.java
+++ b/ballerina/proxy/src/main/java/org/ballerinalang/openwhisk/runtime/BallerinaProxy.java
@@ -17,6 +17,7 @@
 
 package org.ballerinalang.openwhisk.runtime;
 
+import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import org.ballerinalang.BLangProgramLoader;
 import org.ballerinalang.logging.BLogManager;
@@ -38,6 +39,7 @@
 import java.util.Map;
 import java.util.Optional;
 import java.util.logging.LogManager;
+import java.util.Set;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Context;
@@ -168,11 +170,12 @@ public Response run(@Context Request request) {
      */
     @SuppressWarnings({ "unchecked", "rawtypes" })
     private static void augmentEnv(JsonObject requestElements) {
-        HashMap<String, String> env = new HashMap<>();
-        for (String p : new String[] { "api_key", "namespace", "action_name", "activation_id", "deadline" }) {
+        HashMap<String, String> env = new HashMap<String, String>();
+        Set<Map.Entry<String, JsonElement>> entrySet = requestElements.entrySet();
+        for(Map.Entry<String, JsonElement> entry : entrySet){
             try {
-                String val = requestElements.getAsJsonPrimitive(p).getAsString();
-                env.put(String.format("__OW_%s", p.toUpperCase()), val);
+                if(!entry.getKey().equalsIgnoreCase("value"))
+                    env.put(String.format("__OW_%s", entry.getKey().toUpperCase()), entry.getValue().getAsString());
             } catch (Exception ignored) {
             }
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services