From 83d571ae202340ad43f611756e36544cac1e3118 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 10 Mar 2021 22:30:33 +0100 Subject: [PATCH] Fix --- scripts/change_url | 18 ++++++++---------- scripts/install | 23 ++++++++++------------- scripts/upgrade | 36 +++++++++++++++++------------------- 3 files changed, 35 insertions(+), 42 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index ba20f9b..ad20b77 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -113,18 +113,16 @@ fi ynh_backup_if_checksum_is_different --file="$final_path/config.json" domain=$new_domain -path_url=${new_path:1} +path_url=$new_path -# cp ../conf/config.json.example "$final_path/config.json" +cp ../conf/config.json.example "$final_path/config.json" -# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json" - -ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json" ynh_store_file_checksum --file="$final_path/config.json" diff --git a/scripts/install b/scripts/install index 5d6bec6..adf1fc6 100644 --- a/scripts/install +++ b/scripts/install @@ -135,27 +135,24 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -# cp ../conf/config.json.example "$final_path/config.json" +cp ../conf/config.json.example "$final_path/config.json" -path_url=${path_url:1} # Main config File -# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json" -# ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json" -ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" ynh_store_file_checksum --file="$final_path/config.json" -# cp ../conf/.sequelizerc.example "$final_path/.sequelizerc" +cp ../conf/.sequelizerc.example "$final_path/.sequelizerc" # # DB Config File -# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.sequelizerc" -# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/.sequelizerc" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.sequelizerc" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/.sequelizerc" -ynh_add_config --template="../conf/.sequelizerc.example" --destination="$final_path/.sequelizerc" ynh_store_file_checksum --file="$final_path/.sequelizerc" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7504a08..e5dd990 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -127,35 +127,33 @@ then popd || ynh_die fi -# #================================================= -# # MODIFY A CONFIG FILE -# #================================================= -# ynh_script_progression --message="Modifying a config file..." --weight=2 +#================================================= +# MODIFY A CONFIG FILE +#================================================= +ynh_script_progression --message="Modifying a config file..." --weight=2 -# ynh_backup_if_checksum_is_different --file="$final_path/config.json" +ynh_backup_if_checksum_is_different --file="$final_path/config.json" -# path_url=${path_url:1} -# # cp ../conf/config.json.example "$final_path/config.json" +cp ../conf/config.json.example "$final_path/config.json" -# # # Main config File -# # ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json" -# # ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json" -# # ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json" -# # ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json" -# # ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json" -# # ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json" +# # Main config File +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json" -# ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" -# # Recalculate and store the checksum of the file for the next upgrade. -# ynh_store_file_checksum --file="$final_path/config.json" +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum --file="$final_path/config.json" #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=2 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" # Create a dedicated systemd config ynh_add_systemd_config