From f41e3bf3387f02c559acba3cb56d66c772d480e6 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 11 Apr 2019 19:57:28 +0200 Subject: [PATCH 1/2] upgrade .env configuration file during upgrade --- scripts/upgrade | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 775e04db..3f5ba5ca 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ is_public=$(ynh_app_setting_get "$app" is_public) final_path=$(ynh_app_setting_get "$app" final_path) language=$(ynh_app_setting_get "$app" language) db_name=$(ynh_app_setting_get "$app" db_name) +db_user=$db_name #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -134,6 +135,20 @@ chown -R "$app": "$final_path" ynh_install_composer --workdir="$final_path" +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +config="$final_path/.env" +cp -f ../conf/.env "$config" + +ynh_replace_string "__APP__" "$app" "$config" +ynh_replace_string "__DOMAIN__" "$domain" "$config" +ynh_replace_string "__PATH__" "$path_url" "$config" +ynh_replace_string "__DB_NAME__" "$db_name" "$config" +ynh_replace_string "__DB_USER__" "$db_user" "$config" +ynh_replace_string "__DB_PWD__" "$db_pwd" "$config" + #================================================= # DEPLOYMENT #================================================= @@ -149,11 +164,16 @@ pushd "$final_path" php7.2 artisan horizon:purge popd +#================================================= +# STORE THE CHECKSUM OF THE CONFIG FILE +#================================================= +# Calculate and store the config file checksum into the app settings +ynh_store_file_checksum "$config" -ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" +ynh_backup_if_checksum_is_different "$config" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/.env" +ynh_store_file_checksum "$config" #================================================= # GENERIC FINALIZATION From 871a1afad2fec7a462df8751f272487e2070da5d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 11 Apr 2019 22:01:12 +0200 Subject: [PATCH 2/2] fix db_pwd missing --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 3f5ba5ca..0f38819e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,7 @@ final_path=$(ynh_app_setting_get "$app" final_path) language=$(ynh_app_setting_get "$app" language) db_name=$(ynh_app_setting_get "$app" db_name) db_user=$db_name +db_pwd=$(ynh_app_setting_get "$app" db_pwd) #================================================= # ENSURE DOWNWARD COMPATIBILITY