Skip to content

Commit 7f01f77

Browse files
authored
Merge pull request #4 from devilbox/release-0.3
Fixes #3 Allow to set region via env
2 parents 7aa3a46 + 8d33132 commit 7f01f77

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ make test
7171
| Variable | Default value | Description |
7272
|--------------|---------------|-------------|
7373
| 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 |
74+
| REGION | `` | Choose the region where the ngrok client will connect to host its tunnels. (Defaults to `us`) |.
7475
| 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 |.
7576

7677
### HTTP_TUNNELS

data/docker-entrypoint.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ if ! env | grep -q '^HTTP_TUNNELS='; then
1717
fi
1818

1919

20+
# -------------------------------------------------------------------------------------------------
21+
# SPECIFY REGION
22+
# -------------------------------------------------------------------------------------------------
23+
24+
if ! env | grep -q '^REGION='; then
25+
REGION=
26+
else
27+
REGION="$( env env | grep '^REGION=' | awk -F'=' '{print $2}' | xargs )"
28+
REGION="${REGION##*( )}" # Trim leading whitespaces
29+
REGION="${REGION%%*( )}" # Trim trailing whitespaces
30+
31+
if [ -z "${REGION}" ]; then
32+
>&2 echo "[WARN] REGION specified, but empty"
33+
else
34+
echo "[INFO] Using region as specified in REGION: ${REGION}"
35+
echo "region: ${REGION}" >> "${CONFIG_FILE}"
36+
fi
37+
fi
38+
39+
2040
# -------------------------------------------------------------------------------------------------
2141
# SPECIFY AUTH TOKEN
2242
# -------------------------------------------------------------------------------------------------

data/ngrok.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ log: stdout
1313
#update: false
1414
#update_channel: stable
1515
web_addr: 0.0.0.0:4040
16-
tunnels:

0 commit comments

Comments
 (0)