Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(md5): check avaiable and platform fix #642

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

## Unreleased...

* Fix: check for `md5` availability in platform indepedent way.
Removes need to install coreutils on Mac.
[#642](https://github.com/Kong/kong-pongo/pull/642).

---

## 2.15.0 released 17-Dec-2024
Expand Down
17 changes: 16 additions & 1 deletion pongo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function globals {
fi

# create unique projectID based on file-path (on the host machine)
PROJECT_ID=$(echo -n "$PONGO_WD" | md5sum)
PROJECT_ID=$(echo -n "$PONGO_WD" | $MD5_COMMAND )
PROJECT_ID="${PROJECT_ID:0:8}"

PROJECT_NAME_PREFIX="pongo-"
Expand Down Expand Up @@ -232,6 +232,21 @@ function check_tools {
missing=true
fi

# Detect the MD5 command
if command -v md5sum &> /dev/null; then
# Unix
MD5_COMMAND="md5sum"
elif command -v gmd5sum &> /dev/null; then
# GNU
MD5_COMMAND="gmd5sum"
elif command -v md5 &> /dev/null; then
# BSD/Mac
MD5_COMMAND="md5"
else
>&2 echo "'md5sum', 'gmd5sum', and 'md5' commands not found, please install anyone of them, and make it available in the path."
missing=true
fi

if [[ "$missing" == "true" ]]; then
>&2 echo -e "\033[0;31m[pongo-ERROR] the above dependencies are missing, install and retry.\033[0m"
exit 1
Expand Down
Loading