Make forwarded_port file location configurable (#43)

* Make port forwarding status file dynamic

* Readme updates
This commit is contained in:
Juggels
2019-09-02 16:38:41 +02:00
committed by Quentin McGaw
parent 0a317b8be1
commit d35437bd73
3 changed files with 9 additions and 4 deletions

View File

@@ -20,9 +20,12 @@ if [ "$json" == "" ]; then
exit 1
fi
port=`echo $json | jq .port`
port_file="/forwarded_port"
echo "$port" > $port_file
printf " * Written forwarded port to $port_file\n"
port_status_folder=`dirname "${PORT_FORWARDING_STATUS_FILE}"`
if [ ! -d "${port_status_folder}" ];
mkdir -p "${port_status_folder}"
fi
echo "$port" > "${PORT_FORWARDING_STATUS_FILE}"
printf " * Written forwarded port to ${PORT_FORWARDING_STATUS_FILE}\n"
ip=`wget -qO- https://diagnostic.opendns.com/myip`
exitOnError $? "Unable to read remote VPN IP"
printf " * Forwarded port is $port on remote VPN IP $ip\n"