Files
robot-shop/web/entrypoint.sh
Steve Waterworth 2003a55f4d eum updated for 151
2019-04-09 12:41:31 +01:00

34 lines
823 B
Bash
Executable File

#!/usr/bin/env bash
#set -x
# echo "arg 1 $1"
BASE_DIR=/usr/share/nginx/html
if [ -n "$1" ]
then
exec "$@"
fi
if [ -n "$INSTANA_EUM_KEY" -a -n "$INSTANA_EUM_REPORTING_URL" ]
then
echo "Enabling Instana EUM"
# use | instead of / as command delimiter to avoid eacaping the url
sed -i "s|INSTANA_EUM_KEY|$INSTANA_EUM_KEY|" $BASE_DIR/eum-tmpl.html
sed -i "s|INSTANA_EUM_REPORTING_URL|$INSTANA_EUM_REPORTING_URL|" $BASE_DIR/eum-tmpl.html
cp $BASE_DIR/eum-tmpl.html $BASE_DIR/eum.html
else
echo "EUM not enabled"
cp $BASE_DIR/empty.html $BASE_DIR/eum.html
fi
# make sure nginx can access the eum file
chmod 644 $BASE_DIR/eum.html
# apply environment variables to default.conf
envsubst < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
exec nginx -g "daemon off;"