#!/usr/bin/env bash # Insert / update Meshkee payment-callback proxy locations on a storefront nginx site. # Bank gateways (ZarinPal/Mellat) hit https://{host}/meshkee/payments/{gateway}/callback # which proxies to the API tenant callback route. set -euo pipefail HOST="${1:-}" API_HOST="${MESHKEE_API_HOST:-api.meshkee.com}" if [[ -z "$HOST" ]]; then echo "usage: patch-nginx-pay.sh " >&2 exit 1 fi NGINX_AVAILABLE="/etc/nginx/sites-available/$HOST" if [[ ! -f "$NGINX_AVAILABLE" ]]; then echo "missing nginx site for $HOST" >&2 exit 1 fi proxy_location() { local gateway="$1" local path="/meshkee/payments/${gateway}/callback" cat <"$tmp" mv "$tmp" "$NGINX_AVAILABLE" echo "added: ${path}" } ensure_location zarinpal ensure_location mellat nginx -t systemctl reload nginx echo "patched nginx payment callback locations for $HOST"