123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- if [ -n "$@" ]; then
- exec "$@"
- fi
- if [ -z "$NGROK_PORT" ]; then
- if [ -n "$HTTPS_PORT" ]; then
- NGROK_PORT="$HTTPS_PORT"
- elif [ -n "$HTTPS_PORT" ]; then
- NGROK_PORT="$HTTP_PORT"
- elif [ -n "$APP_PORT" ]; then
- NGROK_PORT="$APP_PORT"
- fi
- fi
- ARGS="ngrok"
- if [ "$NGROK_PROTOCOL" = "TCP" ]; then
- ARGS="$ARGS tcp"
- else
- ARGS="$ARGS http"
- NGROK_PORT="${NGROK_PORT:-80}"
- fi
- if [ -n "$NGROK_AUTH" ]; then
- ARGS="$ARGS -authtoken=$NGROK_AUTH "
- fi
- if [ -n "$NGROK_HOSTNAME" ] && [ -n "$NGROK_AUTH" ]; then
- ARGS="$ARGS -hostname=$NGROK_HOSTNAME "
- elif [ -n "$NGROK_SUBDOMAIN" ] && [ -n "$NGROK_AUTH" ]; then
- ARGS="$ARGS -subdomain=$NGROK_SUBDOMAIN "
- elif [ -n "$NGROK_HOSTNAME" ] || [ -n "$NGROK_SUBDOMAIN" ]; then
- if [ -z "$NGROK_AUTH" ]; then
- echo "You must specify an authentication token after registering at https://ngrok.com to use custom domains."
- exit 1
- fi
- fi
- if [ -n "$NGROK_REGION" ]; then
- ARGS="$ARGS -region=$NGROK_REGION "
- fi
- if [ -n "$NGROK_HEADER" ]; then
- ARGS="$ARGS -host-header=$NGROK_HEADER "
- fi
- if [ -n "$NGROK_USERNAME" ] && [ -n "$NGROK_PASSWORD" ] && [ -n "$NGROK_AUTH" ]; then
- ARGS="$ARGS -auth=\"$NGROK_USERNAME:$NGROK_PASSWORD\" "
- elif [ -n "$NGROK_USERNAME" ] || [ -n "$NGROK_PASSWORD" ]; then
- if [ -z "$NGROK_AUTH" ]; then
- echo "You must specify a username, password, and Ngrok authentication token to use the custom HTTP authentication."
- echo "Sign up for an authentication token at https://ngrok.com"
- exit 1
- fi
- fi
- ARGS="$ARGS -log stdout"
- if [ -z "$NGROK_PORT" ]; then
- echo "You must specify a NGROK_PORT to expose."
- exit 1
- fi
- ARGS="$ARGS `echo $NGROK_PORT | sed 's|^tcp://||'`"
- set -x
- exec $ARGS
|