diff --git a/scripts/change_url b/scripts/change_url index 1986103..89fee3d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -103,7 +103,15 @@ ynh_systemd_action --action=stop --service_name=$app #================================================= # Change the URL in the configuration file -ynh_replace_string "EXTERNAL_URL=.*" "EXTERNAL_URL=https://$new_domain$new_path" "$final_path/.env" + +if [ "$new_path" = "/" ] +then + new_domain_uri="$domain$path_url" +else + new_domain_uri="$domain" +fi + +ynh_replace_string "EXTERNAL_URL=.*" "EXTERNAL_URL=https://$new_domain_uri/" "$final_path/.env" ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. @@ -117,7 +125,6 @@ ynh_store_file_checksum "$final_path/.env" ynh_systemd_action --action=start --service_name=$app - #================================================= # GENERIC FINALISATION #================================================= diff --git a/scripts/install b/scripts/install index f45cc25..e5210b7 100644 --- a/scripts/install +++ b/scripts/install @@ -196,10 +196,16 @@ ynh_add_systemd_config ### (It's compatible with sed regular expressions syntax) cp "../conf/.env" "$final_path/.env" +if [ "$path_url" = "/" ] +then + domain_uri="$domain" +else + domain_uri="$domain$path_url" +fi ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env" ynh_replace_string "__PORT__" "$port" "$final_path/.env" -ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "$final_path/.env" +ynh_replace_string "__DOMAIN_URI__" "$domain_uri" "$final_path/.env" ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.env" #=================================================