Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-5355 backport force url scheme #71

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions s/ecr-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@ ecr-prepare-action() {
app-get-main-ingresses url_scheme main_ingress ecr_ingress ignored
[ -z "$main_ingress" ] && FATAL "Unable to determine the main ingress url (s1)"
[ -z "$ecr_ingress" ] && FATAL "Unable to determine the ecr ingress url (s1)"
if [ -n "$url_scheme" ]; then
main_ingress="$url_scheme://$main_ingress"
else
case "$FORCE_URL_SCHEME" in
case "$FORCE_URL_SCHEME" in
"http")
http-get-working-url main_ingress "http://$main_ingress" "https://$main_ingress"
url_scheme=http
;;
*)
http-get-working-url main_ingress "https://$main_ingress" "http://$main_ingress"
"https")
url_scheme="https"
;;
esac
esac
if [ -n "$url_scheme" ]; then
main_ingress="$url_scheme://$main_ingress"
fi
[ -z "$main_ingress" ] && FATAL "Unable to determine the main ingress url (s2)"
http-get-url-scheme url_scheme "$main_ingress"
Expand Down
17 changes: 0 additions & 17 deletions s/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -899,23 +899,6 @@ http-get-url-scheme() {
_set_var "$1" "${2//:\/\/*/}"
}

http-get-working-url() {
local res_var="$1"
shift
local res
if http-check "$1" --accept-401; then
res="$1"
else
if http-check "$2" --accept-401; then
res="$2"
else
res=""
fi
fi

_set_var "$res_var" "$res"
}

#-----------------------------------------------------------------------------------------------------------------------
# Retrieve the main application ingresses:
# $1: var for the scheme
Expand Down