Skip to content

Commit

Permalink
Add MacOS support, add verbose parameter to muffet as default (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzickap authored Nov 12, 2020
1 parent eaa262d commit 4a8f10a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ Do you want to skip the docker build step? OK, the script mode is also available

Environment variables used by `./entrypoint.sh` script.

| Variable | Default | Description |
| ------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `INPUT_CMD_PARAMS` | `--buffer-size=8192 --max-connections=10 --color=always` | Command line parameters for URL checker [muffet](https://github.com/raviqqe/muffet) - details [here](https://github.com/raviqqe/muffet/blob/master/arguments.go#L16-L34) |
| `INPUT_DEBUG` | false | Enable debug mode for the `./entrypoint.sh` script (`set -x`) |
| `INPUT_PAGES_PATH` | | Relative path to the directory with local web pages |
| `INPUT_RUN_TIMEOUT` | 300 | Maximum number of seconds that URL checker can be running |
| `INPUT_URL` | (**Mandatory / Required**) | URL which will be checked |
| Variable | Default | Description |
| ------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `INPUT_CMD_PARAMS` | `--buffer-size=8192 --max-connections=10 --color=always --verbose` | Command line parameters for URL checker [muffet](https://github.com/raviqqe/muffet) - details [here](https://github.com/raviqqe/muffet/blob/master/arguments.go#L16-L34) |
| `INPUT_DEBUG` | false | Enable debug mode for the `./entrypoint.sh` script (`set -x`) |
| `INPUT_PAGES_PATH` | | Relative path to the directory with local web pages |
| `INPUT_RUN_TIMEOUT` | 300 | Maximum number of seconds that URL checker can be running |
| `INPUT_URL` | (**Mandatory / Required**) | URL which will be checked |

## Full example

Expand Down
13 changes: 9 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export MUFFET_VERSION="2.3.0"
export CADDY_VERSION="2.2.1"

# Command line parameters for muffet
export CMD_PARAMS="${INPUT_CMD_PARAMS:- --buffer-size=8192 --max-connections=10 --color=always}"
export CMD_PARAMS="${INPUT_CMD_PARAMS:- --buffer-size=8192 --max-connections=10 --color=always --verbose}"
# Set path variable containing web pages
export PAGES_PATH=${INPUT_PAGES_PATH:-}
# URL to scan / check
Expand Down Expand Up @@ -71,9 +71,9 @@ trap error_trap ERR
if ! hash muffet &> /dev/null ; then

if [ "${MUFFET_VERSION}" = "latest" ]; then
MUFFET_URL=$(wget -qO- https://api.github.com/repos/raviqqe/muffet/releases/latest | grep "browser_download_url.*muffet_.*_Linux_x86_64.tar.gz" | cut -d \" -f 4)
MUFFET_URL=$(wget -qO- https://api.github.com/repos/raviqqe/muffet/releases/latest | grep "browser_download_url.*muffet_.*_$(uname)_x86_64.tar.gz" | cut -d \" -f 4)
else
MUFFET_URL="https://github.com/raviqqe/muffet/releases/download/v${MUFFET_VERSION}/muffet_${MUFFET_VERSION}_Linux_x86_64.tar.gz"
MUFFET_URL="https://github.com/raviqqe/muffet/releases/download/v${MUFFET_VERSION}/muffet_${MUFFET_VERSION}_$(uname)_x86_64.tar.gz"
fi

wget -qO- "${MUFFET_URL}" | $sudo_cmd tar xzf - -C /usr/local/bin/ muffet
Expand All @@ -82,7 +82,12 @@ fi
# Install caddy if needed
if ! hash caddy &> /dev/null && [ -n "${PAGES_PATH}" ] ; then

PLATFORM=$(uname | tr '[:upper:]' '[:lower:]')
if [[ $(uname) = "Darwin" ]]; then
PLATFORM="mac"
elif [[ $(uname) = "Linux" ]]; then
PLATFORM="linux"
fi

if [ "${CADDY_VERSION}" = "latest" ]; then
CADDY_URL=$(wget --quiet https://api.github.com/repos/caddyserver/caddy/releases/latest -O - | grep "browser_download_url.*caddy_.*_${PLATFORM}_amd64.tar.gz" | cut -d \" -f 4)
else
Expand Down

0 comments on commit 4a8f10a

Please sign in to comment.