openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rab...@apache.org
Subject [openwhisk-runtime-go] branch master updated: propagate openwhisk vars (#118)
Date Wed, 15 Jan 2020 23:38:44 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new fffe10c  propagate openwhisk vars (#118)
fffe10c is described below

commit fffe10c4d53551f0ff692d81423941cb5a449ca1
Author: Michele Sciabarra <30654959+sciabarracom@users.noreply.github.com>
AuthorDate: Thu Jan 16 00:38:38 2020 +0100

    propagate openwhisk vars (#118)
---
 openwhisk/actionProxy.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/openwhisk/actionProxy.go b/openwhisk/actionProxy.go
index d9e7068..805207c 100644
--- a/openwhisk/actionProxy.go
+++ b/openwhisk/actionProxy.go
@@ -26,6 +26,7 @@ import (
 	"net/http"
 	"os"
 	"path/filepath"
+	"strings"
 )
 
 // ActionProxy is the container of the data specific to a server
@@ -71,7 +72,14 @@ func NewActionProxy(baseDir string, compiler string, outFile *os.File,
errFile *
 
 //SetEnv sets the environment
 func (ap *ActionProxy) SetEnv(env map[string]interface{}) {
-	ap.env["__OW_API_HOST"] = os.Getenv("__OW_API_HOST")
+	// propagate all the variables starting with "__OW_"
+	for _, v := range os.Environ() {
+		if strings.HasPrefix(v, "__OW_") {
+			res := strings.Split(v, "=")
+			ap.env[res[0]] = res[1]
+		}
+	}
+	// get other variables from the init payload
 	for k, v := range env {
 		s, ok := v.(string)
 		if ok {


Mime
View raw message