Skip to content

Commit

Permalink
Merge pull request #4 from devilbox/release-0.3
Browse files Browse the repository at this point in the history
Fixes #3 Allow to set region via env
  • Loading branch information
cytopia authored Jun 10, 2019
2 parents 7aa3a46 + 8d33132 commit 7f01f77
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ make test
| Variable | Default value | Description |
|--------------|---------------|-------------|
| HTTP_TUNNELS | `` | HTTP tunnel definition in the form of:<br/><code>&lt;domain.tld&gt;:&lt;addr&gt;:&lt;port&gt;</code><br/>or<br/><code>&lt;domain1.tld&gt;:&lt;addr&gt;:&lt;port&gt;,&lt;domain2.tld&gt;:&lt;addr&gt;:&lt;port&gt;</code><br/><br/><strong>Note:</strong> 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
Expand Down
20 changes: 20 additions & 0 deletions data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
# -------------------------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion data/ngrok.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ log: stdout
#update: false
#update_channel: stable
web_addr: 0.0.0.0:4040
tunnels:

0 comments on commit 7f01f77

Please sign in to comment.