2018-02-17 17:56:17 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Needed for envsubst to replace $ in final rendering
|
|
|
|
export DOLLSIGN=$
|
|
|
|
|
|
|
|
# Bash templating
|
|
|
|
cd /etc/nginx/templates
|
|
|
|
for tpl in * ; do
|
|
|
|
if [ $tpl = "odoo.conf" ]; then
|
2018-02-17 18:20:50 +01:00
|
|
|
echo '' > /etc/nginx/conf.d/$tpl
|
2018-02-17 17:56:17 +01:00
|
|
|
index=0
|
|
|
|
IFS=':' read -ra ODOO_SERVICE <<< "$ODOO_SERVICE"
|
|
|
|
IFS=':' read -ra ODOO_SERVER_NAMES <<< "$ODOO_SERVER_NAMES"
|
|
|
|
for service in "${ODOO_SERVICE[@]}"
|
|
|
|
do
|
|
|
|
SERVICE=${ODOO_SERVICE[$index]}
|
|
|
|
SERVER_NAMES=${ODOO_SERVER_NAMES[$index]}
|
|
|
|
export SERVICE SERVER_NAMES
|
|
|
|
envsubst < $tpl >> /etc/nginx/conf.d/$tpl
|
|
|
|
((index++))
|
|
|
|
done
|
|
|
|
else
|
|
|
|
envsubst < $tpl > /etc/nginx/conf.d/$tpl
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Nginx launch
|
|
|
|
nginx
|