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/01/12 12:18:32 UTC
[GitHub] markusthoemmes closed pull request #3076: allow transformEnvironment.sh to dereference env var values
markusthoemmes closed pull request #3076: allow transformEnvironment.sh to dereference env var values
URL: https://github.com/apache/incubator-openwhisk/pull/3076
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/common/scala/transformEnvironment.sh b/common/scala/transformEnvironment.sh
index 05039ff246..96539aa6ce 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
----------------------------------------------------------------
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