Skip to content

Commit 4f6882b

Browse files
committed
storefront oda enable fails does not affect run
1 parent bfb3ffc commit 4f6882b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/storefront/nginx/15-storefront-extras.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ process_oda() {
1313

1414
echo "$ME: Preparing index.html to enable Oracle Digital Assistant"
1515
storefrontindex="${WWW_DIR}/index.html"
16-
[ -w $storefrontindex ] && echo "$ME: Enabling ODA SDK" || echo "$ME: index.html Not Writable. Exiting..."
17-
sed -i -e 's|<!-- head placeholder 1 -->|<script src="scripts/oda/settings.js"></script>|g' "$storefrontindex"
18-
sed -i -e 's|<!-- head placeholder 2 -->|<script src="scripts/oda/web-sdk.js" onload="initSdk('$(echo -e "\x27")'Bots'$(echo -e "\x27")')"></script>|g' "$storefrontindex"
16+
[ -w ${WWW_DIR} ] && echo "$ME: Enabling ODA SDK..." || (echo "$ME: File System Not Writable. Exiting..." && exit 0)
17+
sed -i -e 's|<!-- head placeholder 1 -->|<script src="scripts/oda/settings.js"></script>|g' "$storefrontindex" || (echo "$ME: *** Failed to enable ODA SDK. Exiting..." && exit 0)
18+
sed -i -e 's|<!-- head placeholder 2 -->|<script src="scripts/oda/web-sdk.js" onload="initSdk('$(echo -e "\x27")'Bots'$(echo -e "\x27")')"></script>|g' "$storefrontindex" || (echo "$ME: *** Failed to enable ODA SDK. Exiting..." && exit 0)
1919

2020
echo "$ME: Setting ODA variables"
2121
odasettingsfile="${ODA_SCRIPTS_DIR}/settings.js"
22-
[ -w $odasettingsfile ] && echo "$ME: Running envsubst to update ODA settings.js" || echo "$ME: settings.js Not Writable. Exiting..."
23-
tmpfile=$(mktemp)
24-
cp -a $odasettingsfile $tmpfile
25-
cat $odasettingsfile | envsubst > $tmpfile && mv $tmpfile $odasettingsfile
22+
[ -w $odasettingsfile ] && echo "$ME: Running envsubst to update ODA settings.js" || (echo "$ME: settings.js Not Writable. Exiting..." && exit 0)
23+
(tmpfile=$(mktemp) && \
24+
(cp -a $odasettingsfile $tmpfile) && \
25+
(cat $odasettingsfile | envsubst > $tmpfile && mv $tmpfile $odasettingsfile)) || (echo "$ME: *** Failed to update settings.js. Exiting..." && exit 0)
2626
fi
2727
}
2828

0 commit comments

Comments
 (0)