#!/usr/bin/env bash
set -euo pipefail

ROOT="/opt/rental-system"

if [[ -f "${ROOT}/.env" ]]; then
  set -a
  # shellcheck disable=SC1091
  source "${ROOT}/.env"
  set +a
fi

WEB_PORT="${WEB_PORT:-3000}"

cd "${ROOT}"
exec /usr/bin/npm run start --workspace @rental/web -- --hostname 0.0.0.0 --port "${WEB_PORT}"
