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 sudo sed -i "s@location .\+ {@location $new_path {@g" $nginx_conf_path fi if [ $old_domain != $new_domain ]; then sudo mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf fi