#!/usr/bin/env bash set -euo pipefail script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" repo_dir="$(cd -- "$script_dir/.." && pwd)" env_file="${AIGW_DEBUG_ENV_FILE:-$repo_dir/.env.debug}" command -v docker >/dev/null 2>&1 || { printf '[aigw-debug] error: docker is not installed\n' >&2 exit 1 } if [[ -f "$env_file" ]]; then compose=(docker compose --env-file "$env_file") else export AIGW_CREDENTIAL_KEY=debug-stop-placeholder export AIGW_ADMIN_TOKEN=debug-stop-placeholder export AIGW_STRIPE_API_KEY=debug-stop-placeholder export AIGW_STRIPE_WEBHOOK_SECRET=debug-stop-placeholder compose=(docker compose) fi cd "$repo_dir" printf '[aigw-debug] stopping services\n' "${compose[@]}" down --remove-orphans printf '[aigw-debug] stopped; PostgreSQL and Redis volumes were preserved\n'