Skip to content

Commit

Permalink
Merge pull request #9 from ThePicklenat0r/Remove-host-network-require…
Browse files Browse the repository at this point in the history
…ment

Remove host network requirement
  • Loading branch information
dy1io authored Jan 8, 2020
2 parents c1498e1 + fcfaad9 commit 79929b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 3 additions & 4 deletions ngrok/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
],
"startup": "system",
"boot": "auto",
"host_network": true,
"ports": {
"4040/tcp": "4040"
},
Expand All @@ -36,15 +35,15 @@
]
},
"schema": {
"log_level": "match(^(crit|warn|error|info|debug)$)",
"log_level": "list(crit|warn|error|info|debug)",
"auth_token": "str?",
"region": "list(us|eu|ap|au|sa|jp|in)?",
"tunnels":
[
{
"name": "str",
"proto": "list(http|tls|tcp)",
"addr": "int(1,65535)",
"addr": "match(^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):([1-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[1-5]))|([1-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[1-5])$)",
"inspect": "bool?",
"auth": "str?",
"host_header": "str?",
Expand All @@ -54,7 +53,7 @@
"crt": "str?",
"key": "str?",
"client_cas": "str?",
"remote_addr": "int(1,65535)?",
"remote_addr": "match(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):([1-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[1-5])$)?",
"metadata": "str?"
}
]
Expand Down
2 changes: 0 additions & 2 deletions ngrok/rootfs/etc/services.d/ngrok/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/with-contenv bashio

bashio::log.info "Starting ngrok..."

exec /usr/bin/ngrok.sh
8 changes: 7 additions & 1 deletion ngrok/rootfs/usr/bin/ngrok.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/with-contenv bashio
set -e
bashio::log.debug "Building ngrok.yml..."
configPath="/ngrok-config/ngrok.yml"
mkdir -p /ngrok-config
echo "log: stdout" > $configPath
Expand Down Expand Up @@ -28,7 +29,11 @@ for id in $(bashio::config "tunnels|keys"); do
fi
addr=$(bashio::config "tunnels[${id}].addr")
if [[ $addr != "null" ]]; then
echo " addr: $addr" >> $configPath
if [[ $addr =~ ^([1-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[1-5])$ ]]; then
echo " addr: 172.30.32.1:$addr" >> $configPath
else
echo " addr: $addr" >> $configPath
fi
fi
inspect=$(bashio::config "tunnels[${id}].inspect")
if [[ $inspect != "null" ]]; then
Expand Down Expand Up @@ -77,4 +82,5 @@ for id in $(bashio::config "tunnels|keys"); do
done
configfile=$(cat $configPath)
bashio::log.debug "Config file: \n${configfile}"
bashio::log.info "Starting ngrok..."
ngrok start --config $configPath --all

0 comments on commit 79929b6

Please sign in to comment.