deploy: route frontend and core through one origin

This commit is contained in:
2026-08-04 15:48:15 +02:00
parent fe5c428354
commit 8ffcaf3db9
10 changed files with 109 additions and 127 deletions
+2 -24
View File
@@ -4,27 +4,5 @@ set -eu
value=${1-}
policy_file=${BACKEND_URL_POLICY_FILE:-/etc/thothii/backend-url-policy.json}
if jq -e --arg value "$value" '.relativeBases | index($value) != null' \
"$policy_file" >/dev/null; then
exit 0
fi
if ! jq -e --arg value "$value" \
'.absolutePattern as $pattern | $value | test($pattern)' \
"$policy_file" >/dev/null; then
exit 2
fi
authority=${value#*://}
authority=${authority%%/*}
port=""
case "$authority" in
*]:*) port=${authority##*:} ;;
*]) ;;
*:*) port=${authority##*:} ;;
esac
if [ -n "$port" ]; then
max_port=$(jq -r '.maxPort' "$policy_file")
if [ "${#port}" -gt 5 ] || [ "$port" -gt "$max_port" ]; then exit 2; fi
fi
jq -e --arg value "$value" '.relativeBases | index($value) != null' \
"$policy_file" >/dev/null