From d23c65acd11c3a7b531c44c95da2bcb11ed3887b Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 10 Apr 2020 10:50:36 +0200 Subject: [PATCH] add a line in config.local.php for domain in change_url script --- scripts/change_url | 7 ++++--- scripts/install | 1 + scripts/upgrade | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 3d3d129..1f0400a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -59,9 +59,8 @@ final_path=/var/www/$app if [ $change_path -eq 1 ] then # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for nginx helper - domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config ynh_add_nginx_config @@ -78,11 +77,13 @@ fi # Change the domain for nginx if [ $change_domain -eq 1 ] then + domain="$new_domain" # Delete file checksum for the old conf file location ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + #ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + ynh_replace_string --match_string="const WWW_URL = '$old_domain' . WWW_URI" --replace_string="const WWW_URI = '$new_domain . WWW_URI';" --target_file="$final_path/config.local.php" fi #================================================= diff --git a/scripts/install b/scripts/install index 2ba6b3d..8c73e04 100644 --- a/scripts/install +++ b/scripts/install @@ -131,6 +131,7 @@ systemctl reload nginx key=$(ynh_string_random --length=50) cp -a $final_path/config.dist.php $final_path/config.local.php ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="//const WWW_URL = 'http://garradin.chezmoi.tld' . WWW_URI" --replace_string="const WWW_URI = '$domain . WWW_URI';" --target_file="$final_path/config.local.php" if [ "$path_url" == "/" ] then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" diff --git a/scripts/upgrade b/scripts/upgrade index 5569589..98f6ece 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -142,6 +142,7 @@ ynh_script_progression --message="final configuration needed..." --time --weight key=$(ynh_string_random --length=50) cp -a $final_path/config.dist.php $final_path/config.local.php ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="//const WWW_URL = 'http://garradin.chezmoi.tld' . WWW_URI" --replace_string="const WWW_URI = '$domain . WWW_URI';" --target_file="$final_path/config.local.php" if [ "$path_url" == "/" ] then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php"