diff --git a/README.md b/README.md index 30151d6..76d1280 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ make test | Variable | Default value | Description | |--------------|---------------|-------------| | HTTP_TUNNELS | `` | HTTP tunnel definition in the form of:
<domain.tld>:<addr>:<port>
or
<domain1.tld>:<addr>:<port>,<domain2.tld>:<addr>:<port>

Note: If you don't use a license you can only specify a single tunnel. If your license is pro enough, you can have multiple comma separated tunnels | +| REGION | `` | Choose the region where the ngrok client will connect to host its tunnels. (Defaults to `us`) |. | AUTHTOKEN | `` | Your Ngrok license authtoken. You don't need to have a license for a single tunnel and can ommit this variable. Nevertheless they also have a free license that might be worth checking out |. ### HTTP_TUNNELS diff --git a/data/docker-entrypoint.sh b/data/docker-entrypoint.sh index 90de4ca..3a9b0c4 100755 --- a/data/docker-entrypoint.sh +++ b/data/docker-entrypoint.sh @@ -17,6 +17,26 @@ if ! env | grep -q '^HTTP_TUNNELS='; then fi +# ------------------------------------------------------------------------------------------------- +# SPECIFY REGION +# ------------------------------------------------------------------------------------------------- + +if ! env | grep -q '^REGION='; then + REGION= +else + REGION="$( env env | grep '^REGION=' | awk -F'=' '{print $2}' | xargs )" + REGION="${REGION##*( )}" # Trim leading whitespaces + REGION="${REGION%%*( )}" # Trim trailing whitespaces + + if [ -z "${REGION}" ]; then + >&2 echo "[WARN] REGION specified, but empty" + else + echo "[INFO] Using region as specified in REGION: ${REGION}" + echo "region: ${REGION}" >> "${CONFIG_FILE}" + fi +fi + + # ------------------------------------------------------------------------------------------------- # SPECIFY AUTH TOKEN # ------------------------------------------------------------------------------------------------- diff --git a/data/ngrok.yml b/data/ngrok.yml index 00072f9..cc28948 100644 --- a/data/ngrok.yml +++ b/data/ngrok.yml @@ -13,4 +13,3 @@ log: stdout #update: false #update_channel: stable web_addr: 0.0.0.0:4040 -tunnels: