Merge branch 'dev' of github.com:Nebucatnetzer/network_inventory into dev

This commit is contained in:
Andreas Zweili 2023-08-27 12:27:08 +02:00
commit 46b0c579e1
1 changed files with 19 additions and 1 deletions

20
dev.sh
View File

@ -40,6 +40,22 @@ _setup () {
overmind quit overmind quit
sleep 2 sleep 2
} }
_open_url () {
if [[ ! -z "${DEFAULT_BROWSER}" ]]; then
$DEFAULT_BROWSER $url
elif type explorer.exe &> /dev/null; then
explorer.exe $url
fi
}
_create_url () {
if [ -f /etc/wsl.conf ]; then
echo "http://localhost:$WEBPORT"
else
echo "http://$(hostname -f):$WEBPORT"
fi
}
#} #}
# Main tasks start # Main tasks start
@ -49,9 +65,11 @@ declare -A descriptions
run () { run () {
_setup _setup
find . -name __pycache__ -o -name "*.pyc" -delete find . -name __pycache__ -o -name "*.pyc" -delete
url=$(_create_url)
sudo iptables -I INPUT -p tcp --dport $WEBPORT -j ACCEPT sudo iptables -I INPUT -p tcp --dport $WEBPORT -j ACCEPT
printf "\n---\n webserver: http://$(hostname -f):$WEBPORT\n---\n"
overmind start -D overmind start -D
printf "\n---\n webserver: $url\n---\n"
_open_url $url
} }
descriptions["run"]="Start the webserver." descriptions["run"]="Start the webserver."
tasks["run"]=run tasks["run"]=run