-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
31 lines (27 loc) · 1.11 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
set -e
if [ -n "${NEWRELIC_LICENSE}" ]; then
{ \
echo "extension = newrelic.so"; \
echo "[newrelic]"; \
echo "newrelic.license = ${NEWRELIC_LICENSE}"; \
echo "newrelic.application_logging.forwarding.log_level = ERROR"; \
echo "newrelic.browser_monitoring.auto_instrument = false"; \
} > /usr/local/etc/php/conf.d/newrelic.ini
if [ -n "${NEWRELIC_DAEMON_ADDRESS}" ]; then
echo "newrelic.daemon.address = ${NEWRELIC_DAEMON_ADDRESS}" >> /usr/local/etc/php/conf.d/newrelic.ini
fi
if [ -z "${NEWRELIC_APP_NAME}" ]; then
if [ -n "${WP_HOME}" ]; then
# Extract the domain name from the WP_HOME variable
# e.g. https://example.com => example.com
appname=$(echo "${WP_HOME}" | awk -F[/:] '{print $4}')
echo "newrelic.appname = ${appname}" >> /usr/local/etc/php/conf.d/newrelic.ini
fi
else
echo "newrelic.appname = ${NEWRELIC_APP_NAME}" >> /usr/local/etc/php/conf.d/newrelic.ini
fi
else
echo "New Relic license key or daemon address not set. Skipping New Relic setup."
fi
exec "$@"