test_apps/change_url_app_ynh/scripts/change_url

23 lines
561 B
Text
Raw Normal View History

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
sudo sed -i "s@location .\+ {@location / {@g" $nginx_conf_path
else
2017-03-29 22:52:08 +02:00
sudo 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
sudo mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
fi