This repository was archived by the owner on Feb 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed
Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change 55#
66# SPDX-License-Identifier: Apache-2.0
77
8+ # Keep this shell script POSIX compliant
89# First argument: Path to env.js which needs to be modified
910# Second argument: Path to BPA jar file to replace env.js
1011echo " Start setting runtime variables"
1112
12- # Overwrite frontend runtime variables with environment variables from container
13- sed -i ' s#__SIDEBAR_CLOSE_ON_STARTUP__# ' " $ SIDEBAR_CLOSE_ON_STARTUP" ' #g ' " $1 "
14- sed -i ' s#__SIDEBAR_HIDE_BURGER_BUTTON__# ' " $SIDEBAR_HIDE_BURGER_BUTTON " ' #g ' " $1 "
13+ # Add new runtime variable names in this string delimited by a space character ' '
14+ definedVariables= " SIDEBAR_CLOSE_ON_STARTUP SIDEBAR_HIDE_BURGER_BUTTON "
15+ modifiedVariablesCounter=0
1516
16- # Overwrite env.js in given jar file (path)
17- jar uf " $2 " " $1 "
17+ for item in $definedVariables ; do # Do not use double-quotes for $definedVariables
18+ eval envvar=\"\$ " $item " \"
19+ if [ -n " $envvar " ]; then
20+ echo " Runtime variable $item is set to '$envvar '"
21+
22+ # Overwrite frontend runtime variables in env.js with environment variables from container
23+ sed -i " s#__${item} __#" " $envvar " ' #g' " $1 "
24+ modifiedVariablesCounter=$(( modifiedVariablesCounter+ 1 ))
25+ fi
26+ done
27+
28+ # Overwrite env.js file in given jar file (path) if at least one runtime variable is set
29+ if [ " $modifiedVariablesCounter " -gt 0 ]; then
30+ echo " Updating env.js file in jar"
31+ jar uf " $2 " " $1 "
32+ fi
1833
1934echo " Finish setting runtime variables"
You can’t perform that action at this time.
0 commit comments