[PR #4596] [MERGED] chore: improve health check script #4862

Closed
opened 2026-03-17 02:21:40 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4596
Author: @progprnv
Created: 12/6/2024
Status: Merged
Merged: 2/6/2025
Merged by: @jamesgeorge007

Base: patchHead: main


📝 Commits (1)

  • 2f1d297 Improved code for Update healthcheck.sh

📊 Changes

1 file changed (+6 additions, -7 deletions)

View changed files

📝 healthcheck.sh (+6 -7)

📄 Description

What's changed

  • Added a more flexible exit strategy in the curlCheck function.
  • Changed the script to return status codes instead of directly exiting in curlCheck. Now, the main script decides whether to exit based on those returned statuses.
  • Updated URL checks to gracefully handle failure without prematurely stopping the entire script.

Notes to reviewers

  • The curlCheck function now uses return 1 instead of exit 1, allowing better control over script flow.
  • This change helps in managing multiple URL checks, and the script will only exit if the individual check fails (not all at once).

Improved code:
curlCheck() {
if ! curl -s --head "$1" | head -n 1 | grep -q "HTTP/1.[01] [23].."; then
echo "URL request failed!"
return 1
else
echo "URL request succeeded!"
return 0
fi
}

if [ "$ENABLE_SUBPATH_BASED_ACCESS" = "true" ]; then
curlCheck "http://localhost:80/backend/ping" || exit 1
else
curlCheck "http://localhost:3000" || exit 1
curlCheck "http://localhost:3100" || exit 1
curlCheck "http://localhost:3170/ping" || exit 1
fi


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/4596 **Author:** [@progprnv](https://github.com/progprnv) **Created:** 12/6/2024 **Status:** ✅ Merged **Merged:** 2/6/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `main` --- ### 📝 Commits (1) - [`2f1d297`](https://github.com/hoppscotch/hoppscotch/commit/2f1d297967723183b52f94a30e6c7ba6db828365) Improved code for Update healthcheck.sh ### 📊 Changes **1 file changed** (+6 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `healthcheck.sh` (+6 -7) </details> ### 📄 Description ### What's changed - Added a more flexible exit strategy in the `curlCheck` function. - Changed the script to return status codes instead of directly exiting in `curlCheck`. Now, the main script decides whether to exit based on those returned statuses. - Updated URL checks to gracefully handle failure without prematurely stopping the entire script. ### Notes to reviewers - The `curlCheck` function now uses `return 1` instead of `exit 1`, allowing better control over script flow. - This change helps in managing multiple URL checks, and the script will only exit if the individual check fails (not all at once). Improved code: curlCheck() { if ! curl -s --head "$1" | head -n 1 | grep -q "HTTP/1.[01] [23].."; then echo "URL request failed!" return 1 else echo "URL request succeeded!" return 0 fi } if [ "$ENABLE_SUBPATH_BASED_ACCESS" = "true" ]; then curlCheck "http://localhost:80/backend/ping" || exit 1 else curlCheck "http://localhost:3000" || exit 1 curlCheck "http://localhost:3100" || exit 1 curlCheck "http://localhost:3170/ping" || exit 1 fi --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:21:40 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4862
No description provided.