refactor: move code for fetching an available port to the ports plugin

Also translate the code to golang.
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-09 02:45:36 -04:00
parent 121e4737a8
commit 192f7cf768
9 changed files with 59 additions and 16 deletions

View File

@@ -699,15 +699,8 @@ docker_cleanup() {
get_available_port() {
declare desc="returns first currently unused port > 1024"
while true; do
local port=$(shuf -i 1025-65535 -n 1)
if ! nc -z 0.0.0.0 "$port"; then
echo "$port"
return 0
else
continue
fi
done
dokku_log_warn "Deprecated: please use the 'ports-get-available' plugin trigger instead"
plugn trigger ports-get-available
}
dokku_auth() {