Complete Gitea wrapper host resolution
This commit is contained in:
@@ -248,6 +248,31 @@ get_gitea_login_for_repo_override() {
|
||||
return 1
|
||||
}
|
||||
|
||||
get_host_from_url() {
|
||||
local url="${1:-}"
|
||||
[[ -n "$url" ]] || return 1
|
||||
|
||||
python3 - "$url" <<'PY'
|
||||
import sys
|
||||
from urllib.parse import urlparse
|
||||
|
||||
parsed = urlparse(sys.argv[1])
|
||||
if parsed.hostname:
|
||||
print(parsed.hostname)
|
||||
raise SystemExit(0)
|
||||
raise SystemExit(1)
|
||||
PY
|
||||
}
|
||||
|
||||
get_gitea_api_host_for_repo_override() {
|
||||
if [[ -n "${GITEA_HOST:-}" ]]; then
|
||||
echo "$GITEA_HOST"
|
||||
return 0
|
||||
fi
|
||||
|
||||
get_host_from_url "${GITEA_URL:-}"
|
||||
}
|
||||
|
||||
get_gitea_repo_args() {
|
||||
local repo host login
|
||||
repo=$(get_repo_slug) || return 1
|
||||
|
||||
Reference in New Issue
Block a user