From 52c361116ae885bbc5b306f4e7016d2f7fa2ec8b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 10 Aug 2020 02:12:03 +0200 Subject: [PATCH] Fix change_url --- scripts/change_url | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index a3e94f5..f7daf64 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -112,14 +112,30 @@ fi #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying config file..." +ynh_print_info --message="Modifying config file..." -ynh_use_nodejs +config="$final_path/.env" +ynh_backup_if_checksum_is_different --file="$config" -domain="$new_domain" -path_url="$new_path" +# Change the URL in the configuration file -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +if [ "$new_path" == "/" ] +then + new_domain_uri="$new_domain" +else + new_domain_uri="$new_domain$new_path" +fi + +ynh_replace_string --match_string="EXTERNAL_URL=.*" --replace_string="EXTERNAL_URL=https://$new_domain_uri/" --target_file="$config" + +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= +ynh_print_info --message="Storing the config file checksum..." + + +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALISATION