diff --git a/README.md b/README.md index 37f6fae..8ae816f 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,21 @@ A unified monorepo combining the camera API service and the web dashboard for US ### Production Mode (Docker Compose) -1) Copy env template and set values (for web/Supabase): +**Recommended**: Use the `docker-compose.sh` wrapper script which automatically detects your host IP and sets all environment variables: ```bash -cp .env.example .env -# set VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY in .env +./docker-compose.sh up --build -d ``` -2) Start the stack: +The wrapper script automatically: +- Detects your host machine's IP address +- Sets all required environment variables (VITE_*, HOST_SITE_URL, etc.) +- Generates/updates the `.env` file +- Runs docker-compose with your arguments -```bash -docker compose up --build -``` +**Alternative**: If you prefer to use `docker compose` directly, the `.env` file will be auto-generated on first run, or you can set environment variables manually. + +For more details, see [Docker Compose Environment Setup](docs/DOCKER_COMPOSE_ENV_SETUP.md). - Web: - API: diff --git a/docker-compose.sh b/docker-compose.sh new file mode 100755 index 0000000..17484e0 --- /dev/null +++ b/docker-compose.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Docker Compose wrapper that automatically detects and sets host IP +# Usage: ./docker-compose.sh [docker-compose-command] [args...] +# Example: ./docker-compose.sh up -d + +set -e + +# Get the script directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$SCRIPT_DIR" + +# Change to project root +cd "$PROJECT_ROOT" || exit 1 + +# Detect host IP +HOST_IP=$("$SCRIPT_DIR/scripts/get-host-ip.sh") +if [ $? -ne 0 ] || [ -z "$HOST_IP" ] || [ "$HOST_IP" = "127.0.0.1" ]; then + echo "Warning: Could not detect host IP, using localhost" >&2 + HOST_IP="localhost" +fi + +# Set environment variables for docker-compose +export HOST_IP +export HOST_SITE_URL="http://${HOST_IP}:3000" +export SUPABASE_API_URL="http://${HOST_IP}:54321" +export VITE_SUPABASE_URL="http://${HOST_IP}:54321" +export VITE_MEDIA_API_URL="http://${HOST_IP}:8090" +export VITE_VISION_API_URL="http://${HOST_IP}:8000" + +# Also set for Supabase CLI (runs on host) +export HOST_SITE_URL +export SUPABASE_API_URL + +echo "Auto-detected host IP: $HOST_IP" >&2 +echo "Environment variables set:" >&2 +echo " HOST_IP=$HOST_IP" >&2 +echo " HOST_SITE_URL=$HOST_SITE_URL" >&2 +echo " SUPABASE_API_URL=$SUPABASE_API_URL" >&2 +echo " VITE_SUPABASE_URL=$VITE_SUPABASE_URL" >&2 +echo " VITE_MEDIA_API_URL=$VITE_MEDIA_API_URL" >&2 +echo " VITE_VISION_API_URL=$VITE_VISION_API_URL" >&2 +echo "" >&2 + +# Generate/update .env file for docker-compose +ENV_FILE="$PROJECT_ROOT/.env" +cat > "$ENV_FILE" <&2 + # Backup original if it doesn't have our marker + if ! grep -q "# Auto-updated by docker-compose.sh" "$WEB_ENV_FILE" 2>/dev/null; then + cp "$WEB_ENV_FILE" "$WEB_ENV_FILE.backup.$(date +%Y%m%d_%H%M%S)" 2>/dev/null || true + fi + + # Update the file, preserving other settings + # Read existing file and replace URLs + sed -i.bak \ + -e "s|VITE_SUPABASE_URL=.*|VITE_SUPABASE_URL=$VITE_SUPABASE_URL|" \ + -e "s|VITE_VISION_API_URL=.*|VITE_VISION_API_URL=$VITE_VISION_API_URL|" \ + -e "s|VITE_MEDIA_API_URL=.*|VITE_MEDIA_API_URL=$VITE_MEDIA_API_URL|" \ + -e "s|VITE_VIDEO_REMOTE_URL=.*|VITE_VIDEO_REMOTE_URL=http://${HOST_IP}:3001/assets/remoteEntry.js?v=\$(date +%s)|" \ + -e "s|VITE_VISION_SYSTEM_REMOTE_URL=.*|VITE_VISION_SYSTEM_REMOTE_URL=http://${HOST_IP}:3002/assets/remoteEntry.js|" \ + "$WEB_ENV_FILE" 2>/dev/null || true + + # Add marker comment if not present + if ! grep -q "# Auto-updated by docker-compose.sh" "$WEB_ENV_FILE" 2>/dev/null; then + echo "" >> "$WEB_ENV_FILE" + echo "# Auto-updated by docker-compose.sh" >> "$WEB_ENV_FILE" + fi + + rm -f "$WEB_ENV_FILE.bak" 2>/dev/null || true +fi + +echo "Updated .env file with detected values" >&2 +echo "" >&2 + +# Run docker-compose with all arguments +exec docker compose "$@" + diff --git a/docker-compose.yml b/docker-compose.yml index a3d9de1..5692326 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -376,7 +376,8 @@ services: environment: - CHOKIDAR_USEPOLLING=true - TZ=America/New_York - - VITE_SUPABASE_URL=http://localhost:54321 + # Use environment variable with fallback to localhost + - VITE_SUPABASE_URL=${VITE_SUPABASE_URL:-http://localhost:54321} command: > sh -lc " npm install; @@ -403,8 +404,9 @@ services: environment: - CHOKIDAR_USEPOLLING=true - TZ=America/New_York - - VITE_MEDIA_API_URL=http://exp-dash:8090 - - VITE_VISION_API_URL=http://exp-dash:8000 + # Use environment variables with fallback to localhost + - VITE_MEDIA_API_URL=${VITE_MEDIA_API_URL:-http://localhost:8090} + - VITE_VISION_API_URL=${VITE_VISION_API_URL:-http://localhost:8000} volumes: - ./video-remote:/app command: > @@ -426,7 +428,8 @@ services: environment: - CHOKIDAR_USEPOLLING=true - TZ=America/New_York - - VITE_VISION_API_URL=http://exp-dash:8000 + # Use environment variable with fallback to localhost + - VITE_VISION_API_URL=${VITE_VISION_API_URL:-http://localhost:8000} volumes: - ./vision-system-remote:/app command: > diff --git a/docs/DOCKER_COMPOSE_ENV_SETUP.md b/docs/DOCKER_COMPOSE_ENV_SETUP.md new file mode 100644 index 0000000..3cea8a0 --- /dev/null +++ b/docs/DOCKER_COMPOSE_ENV_SETUP.md @@ -0,0 +1,167 @@ +# Docker Compose Environment Setup + +## Overview + +Docker Compose now automatically detects the host machine's IP address and sets all necessary environment variables. No manual script execution is required! + +## Quick Start + +Instead of running `docker compose` directly, use the wrapper script: + +```bash +./docker-compose.sh up -d +./docker-compose.sh down +./docker-compose.sh logs -f +# etc. +``` + +The wrapper script automatically: +1. Detects your host machine's IP address +2. Sets `HOST_SITE_URL` for Supabase auth redirects +3. Sets all `VITE_*` environment variables for React apps +4. Generates/updates the `.env` file +5. Runs docker-compose with all your arguments + +## What Gets Auto-Configured + +The script automatically sets these environment variables: + +- `HOST_IP` - The detected host machine IP (e.g., `192.168.1.87`) +- `HOST_SITE_URL` - Full URL for Supabase auth (e.g., `http://192.168.1.87:3000`) +- `VITE_SUPABASE_URL` - Supabase API URL (e.g., `http://192.168.1.87:54321`) +- `VITE_MEDIA_API_URL` - Media API URL (e.g., `http://192.168.1.87:8090`) +- `VITE_VISION_API_URL` - Vision API URL (e.g., `http://192.168.1.87:8000`) + +## Manual Override + +If you need to override the auto-detected values, you can: + +1. **Set environment variables before running**: + ```bash + export HOST_IP=192.168.1.100 + ./docker-compose.sh up -d + ``` + +2. **Edit the `.env` file** (generated by the script): + ```bash + # Edit .env file + nano .env + # Then run docker compose normally + docker compose up -d + ``` + +3. **Use docker-compose directly** (with fallback values): + ```bash + # The docker-compose.yml has fallback values, so this still works + docker compose up -d + ``` + +## Environment Files + +### Root `.env` File + +The root `.env` file is auto-generated by `docker-compose.sh` and contains: +``` +HOST_IP=192.168.1.87 +HOST_SITE_URL=http://192.168.1.87:3000 +VITE_SUPABASE_URL=http://192.168.1.87:54321 +VITE_MEDIA_API_URL=http://192.168.1.87:8090 +VITE_VISION_API_URL=http://192.168.1.87:8000 +``` + +This file is automatically updated each time you run `docker-compose.sh`. + +### `management-dashboard-web-app/.env` + +This file is optional and can contain: +- `VITE_SUPABASE_URL` - Overrides the docker-compose value +- `VITE_SUPABASE_ANON_KEY` - Required for Supabase authentication + +Example: +```env +VITE_SUPABASE_URL=http://localhost:54321 +VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... +``` + +## For Supabase CLI + +When using Supabase CLI (not Docker Compose services), you still need to set `HOST_SITE_URL`: + +```bash +# Option 1: Use the environment setup script +source ./scripts/set-host-env.sh +supabase start + +# Option 2: Use the wrapper script +./scripts/supabase-with-env.sh start + +# Option 3: Manual +export HOST_SITE_URL="http://$(./scripts/get-host-ip.sh):3000" +supabase start +``` + +## How It Works + +1. **IP Detection**: `scripts/get-host-ip.sh` detects the host IP using multiple methods +2. **Variable Setting**: `docker-compose.sh` sets all environment variables +3. **Env File Generation**: Creates/updates `.env` file for docker-compose to read +4. **Docker Compose**: Reads `.env` and substitutes `${VARIABLE}` syntax in `docker-compose.yml` + +## Troubleshooting + +### IP Detection Fails + +If the script can't detect your IP: + +```bash +# Check what IP is detected +./scripts/get-host-ip.sh + +# Manually set it +export HOST_IP=192.168.1.100 +./docker-compose.sh up -d +``` + +### Services Can't Connect + +Make sure: +1. The detected IP is accessible from your network +2. Firewall allows connections on the required ports +3. Services are using the correct URLs (check container logs) + +### Using Different Ports + +If your services run on different ports, edit `.env` after it's generated: + +```bash +./docker-compose.sh config # Generates .env +nano .env # Edit ports +docker compose up -d # Use docker compose directly now +``` + +## Migration from Manual Setup + +If you were previously setting environment variables manually: + +1. **Remove manual exports** from your shell profile +2. **Use `./docker-compose.sh`** instead of `docker compose` +3. **Delete old `.env` files** if they have hardcoded values (the script will regenerate) + +## Example Workflow + +```bash +# 1. Start all services (auto-detects IP) +./docker-compose.sh up -d + +# 2. Check logs +./docker-compose.sh logs -f web + +# 3. Stop services +./docker-compose.sh down + +# 4. Restart with new IP detection +./docker-compose.sh up -d +``` + +That's it! No more manual environment variable setup needed. + diff --git a/docs/HOST_IP_CONFIGURATION.md b/docs/HOST_IP_CONFIGURATION.md new file mode 100644 index 0000000..850d30f --- /dev/null +++ b/docs/HOST_IP_CONFIGURATION.md @@ -0,0 +1,168 @@ +# Host IP Configuration for Supabase + +## Overview + +The Supabase `config.toml` file uses the `site_url` setting to configure authentication redirects. Instead of hardcoding the host IP address, we now use environment variables that are automatically detected from the host machine. + +## Problem + +Previously, the `site_url` was hardcoded (e.g., `http://exp-dash:3000`), which: +- Doesn't work when the host IP changes +- Requires manual updates for different environments +- Is not portable across different machines + +## Solution + +We now use the `HOST_SITE_URL` environment variable, which is automatically detected using the host machine's IP address. + +## Usage + +### Automatic Detection (Recommended) + +Use the provided scripts to automatically detect and set the host IP: + +```bash +# Option 1: Source the environment setup script +source ./scripts/set-host-env.sh + +# Then run Supabase CLI commands normally +supabase start +supabase db reset +``` + +Or use the wrapper script that does this automatically: + +```bash +# Use the wrapper script for Supabase CLI commands +./scripts/supabase-with-env.sh start +./scripts/supabase-with-env.sh db reset +``` + +### Manual Configuration + +If automatic detection doesn't work or you want to use a specific IP: + +```bash +# Set the environment variable manually +export HOST_SITE_URL="http://192.168.1.100:3000" + +# Or with a different port +export HOST_SITE_URL="http://192.168.1.100:8080" + +# Then run Supabase commands +supabase start +``` + +### For Docker Compose + +If you're using Docker Compose and need to set this for Supabase CLI commands run on the host: + +```bash +# Before running docker compose or Supabase CLI +export HOST_SITE_URL="http://$(./scripts/get-host-ip.sh):3000" +docker compose up -d +``` + +Or add it to your shell profile (`~/.bashrc` or `~/.zshrc`): + +```bash +# Add to ~/.bashrc or ~/.zshrc +export HOST_SITE_URL="http://$(/path/to/USDA-VISION/scripts/get-host-ip.sh):3000" +``` + +## How It Works + +1. **IP Detection Script** (`scripts/get-host-ip.sh`): + - Tries multiple methods to detect the host IP + - Works both inside Docker containers and on the host machine + - Falls back to `127.0.0.1` if detection fails + +2. **Environment Setup Script** (`scripts/set-host-env.sh`): + - Calls the IP detection script + - Sets `HOST_SITE_URL` environment variable + - Can be sourced to set the variable in your current shell + +3. **Supabase Wrapper Script** (`scripts/supabase-with-env.sh`): + - Automatically sets `HOST_SITE_URL` before running Supabase CLI + - Transparent wrapper - just use it instead of `supabase` command + +4. **Config File** (`supabase/config.toml`): + - Uses `env(HOST_SITE_URL)` to read the environment variable + - Supabase CLI automatically substitutes the value + +## Detection Methods + +The IP detection script tries these methods in order: + +1. **Default Gateway** (for containers): Gets the gateway IP which is typically the host +2. **host.docker.internal**: Uses Docker's special DNS name (if available) +3. **Network Interface**: Checks common network interfaces (eth0, enp0s8, etc.) +4. **Hostname Resolution**: Uses `hostname -I` to get the host IP +5. **Fallback**: Returns `127.0.0.1` if all methods fail + +## Troubleshooting + +### IP Detection Fails + +If the script can't detect the IP: + +1. **Check network interfaces**: + ```bash + ip addr show + # or + ifconfig + ``` + +2. **Manually set the IP**: + ```bash + export HOST_SITE_URL="http://YOUR_ACTUAL_IP:3000" + ``` + +3. **Verify the IP is accessible**: + ```bash + ping $(./scripts/get-host-ip.sh) + ``` + +### Supabase CLI Doesn't Use the Variable + +Make sure you: +1. Set `HOST_SITE_URL` before running Supabase CLI +2. Run Supabase CLI from the project root (where `supabase/` directory is) +3. Check that `config.toml` uses `env(HOST_SITE_URL)` syntax + +### Port Mismatch + +If your React app runs on a different port, adjust the port in the URL: + +```bash +export HOST_SITE_URL="http://$(./scripts/get-host-ip.sh):8080" +``` + +## Example Workflow + +```bash +# 1. Navigate to project root +cd /path/to/USDA-VISION + +# 2. Set the environment variable (automatic detection) +source ./scripts/set-host-env.sh + +# 3. Verify it's set +echo $HOST_SITE_URL +# Output: http://192.168.1.100:3000 + +# 4. Start Supabase +supabase start + +# Or use the wrapper script (does steps 2-4 automatically) +./scripts/supabase-with-env.sh start +``` + +## Integration with Docker Compose + +If you're running Supabase via Docker Compose (not CLI), the containers use their own networking. The `HOST_SITE_URL` is primarily for Supabase CLI commands that run on the host machine. + +For container-to-container communication, use Docker service names (e.g., `http://web:8080`). + +For browser-based redirects from Supabase Auth back to your React app, use the actual host IP that the browser can access. + diff --git a/management-dashboard-web-app/supabase/config.toml b/management-dashboard-web-app/supabase/config.toml index 70cea46..b4e8807 100755 --- a/management-dashboard-web-app/supabase/config.toml +++ b/management-dashboard-web-app/supabase/config.toml @@ -82,7 +82,9 @@ enabled = true # Port to use for Supabase Studio. port = 54323 # External URL of the API server that frontend connects to. -api_url = "http://exp-dash" +# Uses SUPABASE_API_URL environment variable (set by docker-compose.sh) +# Format: http://:54321 +api_url = "env(SUPABASE_API_URL)" # OpenAI API Key to use for Supabase AI in the Supabase Studio. openai_api_key = "env(OPENAI_API_KEY)" @@ -118,9 +120,13 @@ file_size_limit = "50MiB" enabled = true # The base URL of your website. Used as an allow-list for redirects and for constructing URLs used # in emails. -site_url = "http://exp-dash:3000" +# Uses HOST_SITE_URL environment variable, which should be set to the full URL (e.g., http://:3000) +# Set this via: export HOST_SITE_URL="http://$(./scripts/get-host-ip.sh):3000" +# Or manually: export HOST_SITE_URL="http://192.168.1.100:3000" +site_url = "env(HOST_SITE_URL)" # A list of *exact* URLs that auth providers are permitted to redirect to post authentication. -additional_redirect_urls = ["https://exp-dash:3000"] +# Uses HOST_SITE_URL environment variable (same as site_url) +additional_redirect_urls = ["env(HOST_SITE_URL)"] # How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week). jwt_expiry = 3600 # If disabled, the refresh token will never expire. diff --git a/scripts/get-host-ip.sh b/scripts/get-host-ip.sh new file mode 100755 index 0000000..f4e8b26 --- /dev/null +++ b/scripts/get-host-ip.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# Script to detect the host machine's IP address +# This is useful for Docker containers that need to connect back to services on the host + +# Method 1: Try to get IP from default gateway (works in most Docker setups) +# The default gateway in a Docker container is typically the host machine +get_ip_from_gateway() { + # Try to get the default gateway IP + if command -v ip >/dev/null 2>&1; then + ip route show default | awk '/default/ {print $3}' 2>/dev/null | head -1 + elif command -v route >/dev/null 2>&1; then + route -n | awk '/^0.0.0.0/ {print $2}' 2>/dev/null | head -1 + fi +} + +# Method 2: Try host.docker.internal (works on Docker Desktop and with extra_hosts) +get_ip_from_host_docker_internal() { + if command -v getent >/dev/null 2>&1; then + getent hosts host.docker.internal 2>/dev/null | awk '{print $1}' | head -1 + elif command -v nslookup >/dev/null 2>&1; then + nslookup host.docker.internal 2>/dev/null | grep -A1 "Name:" | grep "Address:" | awk '{print $2}' | head -1 + fi +} + +# Method 3: Get IP from network interface (for host machine) +get_ip_from_interface() { + # Try common network interfaces + for interface in eth0 enp0s8 enp0s3 ens33; do + if command -v ip >/dev/null 2>&1; then + ip addr show "$interface" 2>/dev/null | grep -oP 'inet \K[\d.]+' | head -1 + elif command -v ifconfig >/dev/null 2>&1; then + ifconfig "$interface" 2>/dev/null | grep -oP 'inet \K[\d.]+' | head -1 + fi + done +} + +# Method 4: Get IP from hostname (if hostname resolves to an IP) +get_ip_from_hostname() { + # Try to resolve the hostname + if command -v hostname >/dev/null 2>&1; then + hostname -I 2>/dev/null | awk '{print $1}' + fi +} + +# Main logic: Try methods in order of reliability +detect_host_ip() { + local ip="" + + # If running inside Docker, try gateway method first + if [ -f /.dockerenv ] || [ -n "${DOCKER_CONTAINER:-}" ]; then + ip=$(get_ip_from_gateway) + if [ -n "$ip" ] && [ "$ip" != "127.0.0.1" ]; then + echo "$ip" + return 0 + fi + + # Try host.docker.internal + ip=$(get_ip_from_host_docker_internal) + if [ -n "$ip" ] && [ "$ip" != "127.0.0.1" ]; then + echo "$ip" + return 0 + fi + fi + + # Try interface method (works on host machine) + ip=$(get_ip_from_interface) + if [ -n "$ip" ] && [ "$ip" != "127.0.0.1" ]; then + echo "$ip" + return 0 + fi + + # Try hostname method + ip=$(get_ip_from_hostname) + if [ -n "$ip" ] && [ "$ip" != "127.0.0.1" ]; then + echo "$ip" + return 0 + fi + + # Fallback: return localhost (not ideal but better than nothing) + echo "127.0.0.1" + return 1 +} + +# Execute and output the IP +detect_host_ip + diff --git a/scripts/set-host-env.sh b/scripts/set-host-env.sh new file mode 100755 index 0000000..9df9f60 --- /dev/null +++ b/scripts/set-host-env.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Script to set HOST_SITE_URL environment variable based on detected host IP +# This should be sourced before running Supabase CLI commands or docker-compose +# Usage: source ./scripts/set-host-env.sh + +# Get the script directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# Detect host IP +HOST_IP=$("$SCRIPT_DIR/get-host-ip.sh") +if [ $? -ne 0 ] || [ -z "$HOST_IP" ]; then + echo "Warning: Could not detect host IP, using localhost" >&2 + HOST_IP="127.0.0.1" +fi + +# Set the environment variable +# Default port is 3000, but can be overridden +PORT="${HOST_PORT:-3000}" +export HOST_SITE_URL="http://${HOST_IP}:${PORT}" + +# Only print messages if not being sourced (when run directly) +if [ "${BASH_SOURCE[0]}" = "${0}" ]; then + echo "Set HOST_SITE_URL=$HOST_SITE_URL" >&2 + echo "To use this in your current shell, run:" >&2 + echo " source $SCRIPT_DIR/set-host-env.sh" >&2 + echo "Or export it manually:" >&2 + echo " export HOST_SITE_URL=\"$HOST_SITE_URL\"" >&2 +else + # Being sourced - just set the variable silently (or with a brief message) + echo "HOST_SITE_URL set to: $HOST_SITE_URL" >&2 +fi + diff --git a/scripts/supabase-with-env.sh b/scripts/supabase-with-env.sh new file mode 100755 index 0000000..d29f423 --- /dev/null +++ b/scripts/supabase-with-env.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Wrapper script for Supabase CLI that automatically sets HOST_SITE_URL +# Usage: ./scripts/supabase-with-env.sh [args...] + +# Get the script directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# Source the environment setup script +source "$SCRIPT_DIR/set-host-env.sh" + +# Change to project root (Supabase CLI looks for supabase/ directory) +cd "$PROJECT_ROOT" || exit 1 + +# Check if supabase command exists +if ! command -v supabase >/dev/null 2>&1; then + echo "Error: Supabase CLI is not installed or not in PATH" >&2 + echo "Install it from: https://supabase.com/docs/guides/cli" >&2 + exit 1 +fi + +# Run the supabase command with all arguments +exec supabase "$@" + diff --git a/supabase/config.toml b/supabase/config.toml index 70cea46..b4e8807 100755 --- a/supabase/config.toml +++ b/supabase/config.toml @@ -82,7 +82,9 @@ enabled = true # Port to use for Supabase Studio. port = 54323 # External URL of the API server that frontend connects to. -api_url = "http://exp-dash" +# Uses SUPABASE_API_URL environment variable (set by docker-compose.sh) +# Format: http://:54321 +api_url = "env(SUPABASE_API_URL)" # OpenAI API Key to use for Supabase AI in the Supabase Studio. openai_api_key = "env(OPENAI_API_KEY)" @@ -118,9 +120,13 @@ file_size_limit = "50MiB" enabled = true # The base URL of your website. Used as an allow-list for redirects and for constructing URLs used # in emails. -site_url = "http://exp-dash:3000" +# Uses HOST_SITE_URL environment variable, which should be set to the full URL (e.g., http://:3000) +# Set this via: export HOST_SITE_URL="http://$(./scripts/get-host-ip.sh):3000" +# Or manually: export HOST_SITE_URL="http://192.168.1.100:3000" +site_url = "env(HOST_SITE_URL)" # A list of *exact* URLs that auth providers are permitted to redirect to post authentication. -additional_redirect_urls = ["https://exp-dash:3000"] +# Uses HOST_SITE_URL environment variable (same as site_url) +additional_redirect_urls = ["env(HOST_SITE_URL)"] # How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week). jwt_expiry = 3600 # If disabled, the refresh token will never expire.