2017-03-12 02:12:45 +01:00
|
|
|
set -eux
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
number=$YNH_APP_INSTANCE_NUMBER
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
old_domain=$YNH_APP_OLD_DOMAIN
|
|
|
|
old_path=$YNH_APP_OLD_PATH
|
|
|
|
new_domain=$YNH_APP_NEW_DOMAIN
|
|
|
|
new_path=$YNH_APP_NEW_PATH
|
|
|
|
|
|
|
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
|
|
|
|
|
|
|
if [[ "$new_path" == "" ]]; then
|
2017-07-17 20:39:30 +02:00
|
|
|
sed -i "s@location .\+ {@location / {@g" $nginx_conf_path
|
2017-03-12 02:12:45 +01:00
|
|
|
else
|
2017-07-17 20:39:30 +02:00
|
|
|
sed -i "s@location .\+ {@location $new_path {@g" $nginx_conf_path
|
2017-03-12 02:12:45 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $old_domain != $new_domain ]; then
|
2017-07-17 20:39:30 +02:00
|
|
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
2017-03-12 02:12:45 +01:00
|
|
|
fi
|