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

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
APP_SRC_DIR="${REPO_ROOT}/frontend/apps/db-status"
SERVED_DIR="${REPO_ROOT}/incoming-files/served/db-status"
FRONTEND_PUBLIC_DIR="${REPO_ROOT}/frontend/public"

mkdir -p "${SERVED_DIR}"
cp "${APP_SRC_DIR}/index.html" "${SERVED_DIR}/index.html"
cp "${APP_SRC_DIR}/index.html" "${FRONTEND_PUBLIC_DIR}/db-status.html"

echo "Published db-status app to ${SERVED_DIR} and ${FRONTEND_PUBLIC_DIR}/db-status.html"
