Commit 14bca1d7 authored by Aleks's avatar Aleks
Browse files

Also propagate changes to change_url

parent bb14e635
...@@ -19,53 +19,22 @@ ynh_abort_if_errors ...@@ -19,53 +19,22 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
old_domain=$YNH_APP_OLD_DOMAIN
old_path_url=$YNH_APP_OLD_PATH
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
domain=$YNH_APP_NEW_DOMAIN domain=$YNH_APP_NEW_DOMAIN
path_url=$YNH_APP_NEW_PATH path_url=$YNH_APP_NEW_PATH
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#==================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#==================================================
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Trim trailing slashes
path_url=$(sed 's@*/$@@' <<< $path_url)
#=================================================
# STORE SETTINGS
#=================================================
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path_url $path_url
#================================================= #=================================================
# CHANGE URL IN NGINX CONFIG # CHANGE URL IN NGINX CONFIG
#================================================= #=================================================
ynh_script_progression "Updating nginx configuration..." ynh_script_progression "Updating nginx configuration..."
ynh_add_nginx_config
cp ../conf/nginx.conf "$nginx_path"
if [[ $path_url == "/" ]]; then
sed -i "/^rewrite/d" "$nginx_path"
path_url=""
fi
sed -i "s@PATHTOCHANGE@$path_url@g" "$nginx_path"
sed -i "s@ALIASTOCHANGE@$final_path@g" "$nginx_path"
if [[ $old_domain != $domain ]]; then
rm -f /etc/nginx/conf.d/$old_domain.d/$app.conf
fi
ynh_script_progression "Reloading nginx web server..."
nginx -tq
ynh_systemd_action nginx reload
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment