2017-03-28 17:46:14 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
chown www-data.www-data "${DOCUMENT_ROOT}"
|
|
|
|
|
|
|
|
for file in /etc/nginx/*/*.conf; do
|
|
|
|
sed -i \
|
|
|
|
-e "s#{{REDIRECT_CODE}}#${REDIRECT_CODE}#g" \
|
|
|
|
-e "s#{{DOCUMENT_ROOT}}#${DOCUMENT_ROOT}#g" \
|
2017-03-28 18:13:15 +00:00
|
|
|
-e "s#{{REDIRECT_SCHEME}}#${REDIRECT_SCHEME}#g" \
|
2017-03-28 17:46:14 +00:00
|
|
|
"${file}"
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "${REDIRECT_MODE}" == "apex-to-www" ]]; then
|
|
|
|
ln -s \
|
|
|
|
/etc/nginx/sites-available/redirect-apex-to-www.conf \
|
|
|
|
/etc/nginx/sites-enabled/redirect-apex-to-www.conf
|
|
|
|
elif [[ "${REDIRECT_MODE}" == "www-to-apex" ]]; then
|
|
|
|
ln -s \
|
|
|
|
/etc/nginx/sites-available/redirect-www-to-apex.conf \
|
|
|
|
/etc/nginx/sites-enabled/redirect-www-to-apex.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec /usr/bin/supervisord
|