Read Mailpit endpoint from deployment config
Some checks are pending
Quality / full-local-gates (push) Waiting to run

This commit is contained in:
SimpleTest 2026-07-21 17:56:00 +03:00
parent eb5e0f896d
commit d432368147
3 changed files with 44 additions and 3 deletions

View File

@ -58,6 +58,14 @@ fi
: "${WNH_BASE_URL:?WNH_BASE_URL is missing from .env}"
: "${WNH_TRACKING_MIN_TIME_MS:?WNH_TRACKING_MIN_TIME_MS is missing from .env}"
: "${WNH_TRACKING_HTTP_TIMEOUT_MS:?WNH_TRACKING_HTTP_TIMEOUT_MS is missing from .env}"
: "${MAILPIT_BIND_ADDRESS:?MAILPIT_BIND_ADDRESS is missing from .env}"
: "${MAILPIT_PORT:?MAILPIT_PORT is missing from .env}"
if [[ ! "$MAILPIT_PORT" =~ ^[0-9]+$ ]] ||
((MAILPIT_PORT < 1 || MAILPIT_PORT > 65535)); then
echo "MAILPIT_PORT must be between 1 and 65535." >&2
exit 1
fi
case "$WNH_BASE_URL" in
https://*/* | https://*) ;;
@ -75,6 +83,12 @@ case "$origin_without_scheme" in
;;
esac
expected_host=${origin_without_scheme%%:*}
mailpit_host=$MAILPIT_BIND_ADDRESS
case "$mailpit_host" in
0.0.0.0 | ::) mailpit_host=127.0.0.1 ;;
*:*) mailpit_host="[$mailpit_host]" ;;
esac
mailpit_url="http://${mailpit_host}:${MAILPIT_PORT}"
mkdir -p "$output_dir"
chmod 700 "$ROOT/output" "$ROOT/output/android-browser-staging-e2e" "$output_dir"
@ -161,7 +175,7 @@ run_browser_phase() {
--network host \
--user "$(id -u):$(id -g)" \
--env "BASE_URL=$WNH_BASE_URL" \
--env MAILPIT_URL=http://127.0.0.1:8027 \
--env "MAILPIT_URL=$mailpit_url" \
--env "CROSS_CLIENT_PHASE=$phase" \
--env "CROSS_CLIENT_REQUESTER_EMAIL=$requester_email" \
--env "CROSS_CLIENT_PASSWORD=$fixture_password" \

View File

@ -26,6 +26,14 @@ fi
: "${PHX_HOST:?PHX_HOST is missing from .env}"
: "${PHX_SCHEME:?PHX_SCHEME is missing from .env}"
: "${PHX_URL_PORT:?PHX_URL_PORT is missing from .env}"
: "${MAILPIT_BIND_ADDRESS:?MAILPIT_BIND_ADDRESS is missing from .env}"
: "${MAILPIT_PORT:?MAILPIT_PORT is missing from .env}"
if [[ ! "$MAILPIT_PORT" =~ ^[0-9]+$ ]] ||
((MAILPIT_PORT < 1 || MAILPIT_PORT > 65535)); then
echo "MAILPIT_PORT must be between 1 and 65535." >&2
exit 1
fi
if [[ "$PHX_SCHEME" != https ]]; then
echo "Public staging E2E requires PHX_SCHEME=https." >&2
@ -35,6 +43,12 @@ fi
run_id="$(date -u +%Y%m%d%H%M%S)-$$"
output_dir="$ROOT/output/staging-e2e/$run_id"
base_url="${PHX_SCHEME}://${PHX_HOST}"
mailpit_host=$MAILPIT_BIND_ADDRESS
case "$mailpit_host" in
0.0.0.0 | ::) mailpit_host=127.0.0.1 ;;
*:*) mailpit_host="[$mailpit_host]" ;;
esac
mailpit_url="http://${mailpit_host}:${MAILPIT_PORT}"
if [[ "$PHX_URL_PORT" != 443 ]]; then
base_url="${base_url}:${PHX_URL_PORT}"
@ -152,7 +166,7 @@ docker run --rm \
--network host \
--user "$(id -u):$(id -g)" \
--env "BASE_URL=$base_url" \
--env MAILPIT_URL=http://127.0.0.1:8027 \
--env "MAILPIT_URL=$mailpit_url" \
--env "E2E_RUN_ID=$run_id" \
--env "E2E_FIXTURE_PASSWORD=$fixture_password" \
--env HOME=/tmp \

View File

@ -30,6 +30,14 @@ fi
: "${PHX_HOST:?PHX_HOST is missing from .env}"
: "${PHX_SCHEME:?PHX_SCHEME is missing from .env}"
: "${PHX_URL_PORT:?PHX_URL_PORT is missing from .env}"
: "${MAILPIT_BIND_ADDRESS:?MAILPIT_BIND_ADDRESS is missing from .env}"
: "${MAILPIT_PORT:?MAILPIT_PORT is missing from .env}"
if [[ ! "$MAILPIT_PORT" =~ ^[0-9]+$ ]] ||
((MAILPIT_PORT < 1 || MAILPIT_PORT > 65535)); then
echo "MAILPIT_PORT must be between 1 and 65535." >&2
exit 1
fi
if [[ "$PHX_SCHEME" != https ]]; then
echo "Public staging E2E requires PHX_SCHEME=https." >&2
@ -39,7 +47,12 @@ fi
run_id="$(date -u +%Y%m%d%H%M%S)-$$"
output_dir="$ROOT/output/staging-full-e2e/$run_id"
base_url="${PHX_SCHEME}://${PHX_HOST}"
mailpit_url=http://127.0.0.1:8027
mailpit_host=$MAILPIT_BIND_ADDRESS
case "$mailpit_host" in
0.0.0.0 | ::) mailpit_host=127.0.0.1 ;;
*:*) mailpit_host="[$mailpit_host]" ;;
esac
mailpit_url="http://${mailpit_host}:${MAILPIT_PORT}"
admin_email="wnh-staging-e2e-$run_id-admin@example.invalid"
if [[ "$PHX_URL_PORT" != 443 ]]; then