jevhooks.git / tools / deploy-web.sh
1#!/usr/bin/env bash

The owner's deploy of the website Worker (jevhooks, web/) to hooks.lmjtfy.fun.

tools/deploy-web.sh [wrangler deploy arguments...]      (mise run web:deploy)

Runs under tools/with-secrets.sh, so fnox supplies CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID (declared in fnox.toml) when a provider is set for them; otherwise both must already be in the environment, which is where wrangler reads them. It refuses, saying so, when either is missing. SITE_ORIGIN is the canonical address: every other address the Worker is reached at sends a reader on to it.

11set -euo pipefail
12cd "$(dirname "$0")/.."
14if [ -z "${JEVHOOKS_DEPLOY_INNER:-}" ]; then
15  exec env JEVHOOKS_DEPLOY_INNER=1 tools/with-secrets.sh "$0" "$@"
16fi
17
18for name in CLOUDFLARE_API_TOKEN CLOUDFLARE_ACCOUNT_ID; do
19  if [ -z "${!name:-}" ]; then
20    echo "deploy-web: $name is not set. Export it, or set a fnox provider for it (see fnox.toml), and run again." >&2
21    exit 1
22  fi
23done
24
25cd web
26exec wrangler deploy --var "SITE_ORIGIN:${SITE_ORIGIN:-https://hooks.lmjtfy.fun}" "$@"