Files
robot-shop/web/entrypoint.sh

34 lines
823 B
Bash
Raw Normal View History

2018-02-13 16:56:45 +00:00
#!/usr/bin/env bash
2019-04-09 12:41:31 +01:00
#set -x
2018-02-13 16:56:45 +00:00
# echo "arg 1 $1"
BASE_DIR=/usr/share/nginx/html
if [ -n "$1" ]
then
exec "$@"
fi
2019-04-09 12:41:31 +01:00
if [ -n "$INSTANA_EUM_KEY" -a -n "$INSTANA_EUM_REPORTING_URL" ]
2018-02-13 16:56:45 +00:00
then
echo "Enabling Instana EUM"
2019-04-09 12:41:31 +01:00
# 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
2018-02-13 16:56:45 +00:00
else
2019-04-09 12:41:31 +01:00
echo "EUM not enabled"
2018-02-13 16:56:45 +00:00
cp $BASE_DIR/empty.html $BASE_DIR/eum.html
fi
2018-03-27 17:39:05 +01:00
# 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
2018-02-13 16:56:45 +00:00
exec nginx -g "daemon off;"