lilith-platform.live/scripts/run/admin.sh
autocommit 92a8eaed2b ci(workflows-CI/CD): 👷 Update Forgejo admin deployment workflows, docs, and configs for CI/CD pipeline
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-04-24 20:04:59 -07:00

39 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# Admin commands for lilith-platform.live
# Sourced by the top-level ./run script — do not execute directly.
# ROOT_DIR is set by the caller.
COMMAND="${1:-}"
shift || true
case "$COMMAND" in
admin:seed-passphrase)
bash "$ROOT_DIR/deployments/@domains/quinn.admin/scripts/seed-passphrase.sh" "$@"
;;
admin:migrate)
ENV="${1:-dev}"
API_DIR="$ROOT_DIR/codebase/@features/api"
if [[ "$ENV" == "prod" ]]; then
# Requires QUINN_DB_URL pointing at production Postgres (e.g. via SSH tunnel).
# Set QUINN_DB_URL before calling, or this will target whatever your local env uses.
if [[ -z "${QUINN_DB_URL:-}" ]]; then
echo "ERROR: QUINN_DB_URL must be set to target production. Aborting." >&2
exit 1
fi
echo "==> Running @features/api migrations against QUINN_DB_URL=${QUINN_DB_URL}..."
else
echo "==> Running @features/api migrations (dev)..."
fi
cd "$API_DIR" && bun run migrate
;;
*)
echo "Unknown admin command: $COMMAND"
echo ""
echo "Admin commands:"
echo " ./run admin:seed-passphrase Seed admin passphrase on VPS"
echo " ./run admin:migrate [dev|prod] Run @features/api DB migrations (default: dev)"
exit 1
;;
esac