#!/bin/bash

set -eu

# Check if the API origin is set, if not prompt the user to enter it
if [[ -z "${DASHBOARD_DEVELOPMENT_ORIGIN:-}" ]]; then
  read -p "Enter the API origin (e.g. http://localhost:3000): " DASHBOARD_DEVELOPMENT_ORIGIN
fi

echo "=> Set API origin"
export VITE_API_ORIGIN="${DASHBOARD_DEVELOPMENT_ORIGIN}"

# only really used for prod builds to bust cache
export VITE_CACHE_ID="develop"

echo "=> Run vite locally"
npm run dev
