test_apps/change_url_app_ynh/scripts/change_url

23 lines
546 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
sed -i "s@location .\+ {@location / {@g" $nginx_conf_path
2017-03-12 02:12:45 +01:00
else
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
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
2017-03-12 02:12:45 +01:00
fi