#!/usr/bin/env bash # Insert Meshkee SEO proxy locations (/sitemap.xml, /robots.txt) into an existing storefront nginx site. set -euo pipefail HOST="${1:-}" API_HOST="${MESHKEE_API_HOST:-api.meshkee.com}" if [[ -z "$HOST" ]]; then echo "usage: patch-nginx-seo.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 if grep -q 'location = /sitemap.xml' "$NGINX_AVAILABLE"; then echo "nginx SEO locations already present for $HOST" exit 0 fi TMP="$(mktemp)" SEO_BLOCK="$(cat <"$TMP" mv "$TMP" "$NGINX_AVAILABLE" nginx -t systemctl reload nginx echo "patched nginx SEO locations for $HOST"