Skip to content

Commit 064cfd9

Browse files
committed
Check to make sure ngrok is configured correctly before sharing
1 parent 1cf5563 commit 064cfd9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

valet

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ then
5050
if [[ $SHARETOOL = "ngrok" ]]
5151
then
5252
# ngrok
53+
# Check to make sure ngrok is configured correctly
54+
BREW_PREFIX=$(brew --prefix)
55+
$($BREW_PREFIX/bin/ngrok config check >/dev/null 2>&1)
56+
57+
if [[ $? -ne 0 ]]; then
58+
echo "Please sign up for a free ngrok account and then run valet set-ngrok-token {yourTokenHere}."
59+
exit
60+
fi
61+
5362
# Check for parameters to pass through to ngrok (these will start with '-' or '--')
5463
PARAMS=(${@:2})
5564
for PARAM in ${PARAMS[@]}
@@ -85,7 +94,6 @@ then
8594
# Lowercase the host to match how the rest of our domains are looked up
8695
HOST=$(echo "$HOST" | tr '[:upper:]' '[:lower:]')
8796

88-
BREW_PREFIX=$(brew --prefix)
8997
sudo -u "$USER" "$BREW_PREFIX/bin/ngrok" http "$HOST.$TLD:$PORT" --host-header=rewrite $PARAMS
9098

9199
exit

0 commit comments

Comments
 (0)