Add function generate_redirect_urls

This commit is contained in:
juarez
2023-11-23 10:38:50 +01:00
parent 3c8ec73ac3
commit bb076c5d5a
3 changed files with 17 additions and 7 deletions

View File

@ -292,3 +292,18 @@ capitalize_first_letter() {
capitalized="$(tr '[:lower:]' '[:upper:]' <<< ${input:0:1})${input:1}"
echo "$capitalized"
}
generate_redirect_urls(){
local redirect_urls="https://${HOST}$1"
local host_without_proxy="$(echo "$HOST" | cut -d '.' -f1)"
local port="$(echo "$HOST" | rev | cut -d ':' -f1 | rev)"
if [ -z "${port}" ]; then
port=""
else
port=":$port"
fi
if [[ "$HOST" != "$host_without_proxy" ]]; then
redirect_urls+=",https://$host_without_proxy$port$1"
fi
echo "$redirect_urls"
}