diff --git a/scripts/change_url b/scripts/change_url index 5fe0855..b947e02 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,6 +30,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) path_url=$(ynh_app_setting_get --app=$app --key=path) port=$(ynh_app_setting_get --app=$app --key=port) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -102,6 +105,29 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +# CONFIGURE CODIMD +#================================================= + +ynh_backup_if_checksum_is_different --file="$final_path/config.json" + +domain=$new_domain +path_url=$new_path + +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%/}" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --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_PASS__" --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" + #================================================= # GENERIC FINALISATION #=================================================