-
Notifications
You must be signed in to change notification settings - Fork 29
/
start.sh
53 lines (40 loc) · 928 Bytes
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh -e
CMD="ngrok"
$CMD authtoken ${AUTH_TOKEN:-''} > /dev/null
PARAMS=${PARAMS:-$(echo $@)}
if [[ -n "$PARAMS" ]]; then
if [[ "$PARAMS" == "$CMD "* ]]; then
CMD="$PARAMS"
else
CMD="$CMD $PARAMS"
fi
else
PROTOCOL=${PROTOCOL:-http}
PORT=${PORT:-80}
CMD="$CMD $PROTOCOL"
if [[ -n "$REGION" ]]; then
CMD="$CMD -region=$REGION"
fi
if [[ -n "$HOST_HEADER" ]]; then
CMD="$CMD -host-header=$HOST_HEADER"
fi
if [[ -n "$BIND_TLS" ]]; then
CMD="$CMD -bind-tls=$BIND_TLS"
fi
if [[ -n "$SUBDOMAIN" ]]; then
CMD="$CMD -subdomain=$SUBDOMAIN"
fi
if [[ -n "$BASICAUTH" ]]; then
CMD="$CMD --auth=$BASICAUTH"
fi
if [[ -n "$DEBUG" ]]; then
CMD="$CMD -log stdout"
fi
if [[ -n "$DOMAIN" ]]; then
CMD="$CMD $DOMAIN:$PORT"
else
CMD="$CMD $PORT"
fi
fi
set -x
exec $CMD