Adds NGROK_PORT as per issue #3.
This commit is contained in:
parent
955515af69
commit
4f5fdae585
|
@ -74,6 +74,7 @@ Additionally, you can specify one of several environment variable (via `-e`) to
|
|||
* `NGROK_USERNAME` - Username to use for HTTP authentication on the tunnel. You must also specify an authentication token.
|
||||
* `NGROK_PASSWORD` - Password to use for HTTP authentication on the tunnel. You must also specify an authentication token.
|
||||
* `NGROK_PROTOCOL` - Can either be `HTTP` or `TCP`, and it defaults to `HTTP` if not specified. If set to `TCP`, Ngrok will allocate a port instead of a subdomain and proxy TCP requests directly to your application.
|
||||
* `NGROK_PORT` - Port to expose (defaults to `80` for `HTTP` protocol).
|
||||
|
||||
|
||||
## Feedbacks
|
||||
|
|
|
@ -4,6 +4,17 @@ if [ -n "$@" ]; then
|
|||
exec "$@"
|
||||
fi
|
||||
|
||||
# Legacy compatible:
|
||||
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"
|
||||
|
||||
|
@ -12,6 +23,7 @@ if [ "$NGROK_PROTOCOL" = "TCP" ]; then
|
|||
ARGS="$ARGS tcp"
|
||||
else
|
||||
ARGS="$ARGS http"
|
||||
NGROK_PORT="${NGROK_PORT:-80}"
|
||||
fi
|
||||
|
||||
# Set the authorization token.
|
||||
|
@ -47,14 +59,12 @@ fi
|
|||
|
||||
ARGS="$ARGS -log stdout"
|
||||
|
||||
# Set the point.
|
||||
if [ -n "$HTTPS_PORT" ]; then
|
||||
ARGS="$ARGS `echo $HTTPS_PORT | sed 's|^tcp://||'`"
|
||||
elif [ -n "$HTTP_PORT" ]; then
|
||||
ARGS="$ARGS `echo $HTTP_PORT | sed 's|^tcp://||'`"
|
||||
elif [ -n "$APP_PORT" ]; then
|
||||
ARGS="$ARGS `echo $APP_PORT | sed 's|^tcp://||'`"
|
||||
# Set the port.
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue