You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ma...@apache.org on 2018/01/12 12:18:32 UTC

[incubator-openwhisk] branch master updated: Allow `transformEnvironment.sh` to dereference environment values. (#3076)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 56ab4fe  Allow `transformEnvironment.sh` to dereference environment values. (#3076)
56ab4fe is described below

commit 56ab4feedd31715917a7376d9277258351fecd2c
Author: tysonnorris <ty...@gmail.com>
AuthorDate: Fri Jan 12 04:18:28 2018 -0800

    Allow `transformEnvironment.sh` to dereference environment values. (#3076)
---
 common/scala/transformEnvironment.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/common/scala/transformEnvironment.sh b/common/scala/transformEnvironment.sh
index 05039ff..96539aa 100755
--- a/common/scala/transformEnvironment.sh
+++ b/common/scala/transformEnvironment.sh
@@ -21,6 +21,18 @@ props=()
 for var in $configVariables
 do
     value=$(printenv "$var")
+    #allow us to dereference environment variables, e.g. CONFIG_some_key=$SOME_ENV_VAR
+    if [[ $value == \$* ]] # iff the value starts with $
+    then
+        varname=${value:1} # drop the starting '$'
+        value2=${!varname} # '!' dereferences the variable
+        if [ ! -z "$value2" ]
+        then
+            value=$value2 # replace $value with $value2 (the dereferenced value)
+        fi
+    fi
+
+
     if [ ! -z "$value" ]
     then
         sansConfig=${var#$prefix} # remove the CONFIG_ prefix

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].