The owner tests from other devices of the private network: every test surface is addressed by the machine's LAN address, never 127.0.0.1 or localhost, never hard-coded. scripts/dev-env.sh decides the host once (hostname -I, FAUNOSTEO_DEV_HOST override, production hosts refused); scripts/supabase.sh exports it for every CLI call (pnpm db:*, pnpm supabase) because config.toml now reads api.external_url (mail links), auth.site_url and studio.api_url with env(); scripts/dev.sh = pnpm dev on that origin, pnpm dev:offline keeps the local tool alone; dev-lan.sh removed. Verified: GoTrue API_EXTERNAL_URL and Studio SUPABASE_PUBLIC_URL on the LAN address, a signup mail linking to http://<lan>:54321/auth/v1/verify, the four published ports answering from a separate Docker network, and the 10-step procedure in headless Chromium at the LAN origin with every request URL audited (no 127.0.0.1 / localhost).
27 lines
1.4 KiB
Bash
27 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
# shellcheck shell=bash
|
|
# The one place the DEV origin is decided (docs/development/ENVIRONMENTS.md §2).
|
|
# Sourced by the wrappers (scripts/supabase.sh, scripts/dev.sh, scripts/avatar-e2e.sh):
|
|
# every service the browser of another device must reach is addressed by the
|
|
# host's LAN address, never by 127.0.0.1 or localhost.
|
|
#
|
|
# FAUNOSTEO_DEV_HOST the address or name of this machine on the private network;
|
|
# unset = the first non-loopback IPv4 of the host; 127.0.0.1 for
|
|
# a host-only session. Never a production host.
|
|
#
|
|
# Exports FAUNOSTEO_DEV_HOST and the derived URLs read by supabase/config.toml
|
|
# (env() substitution) and by the Vite dev server.
|
|
if [ -z "${FAUNOSTEO_DEV_HOST:-}" ]; then
|
|
FAUNOSTEO_DEV_HOST="$(hostname -I 2>/dev/null | awk '{print $1}')"
|
|
[ -n "$FAUNOSTEO_DEV_HOST" ] || FAUNOSTEO_DEV_HOST=127.0.0.1
|
|
fi
|
|
case "$FAUNOSTEO_DEV_HOST" in
|
|
*faunosteo.com*) echo "dev-env: FAUNOSTEO_DEV_HOST must never be a production host ($FAUNOSTEO_DEV_HOST)" >&2; return 1 ;;
|
|
esac
|
|
export FAUNOSTEO_DEV_HOST
|
|
export FAUNOSTEO_DEV_API_ORIGIN="http://$FAUNOSTEO_DEV_HOST"
|
|
export FAUNOSTEO_DEV_API_URL="http://$FAUNOSTEO_DEV_HOST:54321"
|
|
export FAUNOSTEO_DEV_SITE_URL="http://$FAUNOSTEO_DEV_HOST:5173"
|
|
export FAUNOSTEO_DEV_STUDIO_URL="http://$FAUNOSTEO_DEV_HOST:54323"
|
|
export FAUNOSTEO_DEV_MAILPIT_URL="http://$FAUNOSTEO_DEV_HOST:54324"
|