feat(lib): extract port from ROOT_URL if set
This commit is contained in:
parent
80d43f545a
commit
0f3611e745
1 changed files with 10 additions and 0 deletions
10
lib/lib.sh
10
lib/lib.sh
|
|
@ -323,6 +323,16 @@ function get_host_port() {
|
||||||
if test -z "$config"; then
|
if test -z "$config"; then
|
||||||
echo "$IP:3000"
|
echo "$IP:3000"
|
||||||
else
|
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)"
|
echo "$IP:$(sed -n -e 's/^HTTP_PORT *= *\(.*\)/\1/p' <$config)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue