29 lines
671 B
Bash
29 lines
671 B
Bash
|
#!/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
|
||
|
echo '' > /etc/nginx/conf/$tpl
|
||
|
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
|