feat(lib): extract port from ROOT_URL if set

This commit is contained in:
famfo 2026-02-13 19:29:37 +01:00
parent 80d43f545a
commit 0f3611e745
No known key found for this signature in database

View file

@ -323,6 +323,16 @@ function get_host_port() {
if test -z "$config"; then
echo "$IP:3000"
else
# Try to extract custom port from explicitly set ROOT_URL
local root_url="$(sed -ne 's/^ROOT_URL *= *\(.*\)/\1/p' < "$config")"
local port="${root_url##*:}"
if [[ ! -z "$port" ]]; then
echo "$IP:$port"
exit
fi
# Fall back to the set port
echo "$IP:$(sed -n -e 's/^HTTP_PORT *= *\(.*\)/\1/p' <$config)"
fi
}