Files
website/scripts/tools-run.sh
T

12 lines
624 B
Bash
Executable File

#!/usr/bin/env bash
# Run scripts/tools.ts on stan-ovh against prod, without printing secrets.
# scripts/tools-run.sh list | import <file.json> | add '<json>' | delete <id> (see scripts/tools.ts)
# DB_URL (app role) comes from the running app container (db:5432 → 127.0.0.1:5440).
set -euo pipefail
cd "$(dirname "$0")/.."
DB_URL=$(sudo -n docker inspect personal-website-app-1 --format '{{range .Config.Env}}{{println .}}{{end}}' \
| sed -n 's/^DB_URL=//p' | sed 's/@db:5432/@127.0.0.1:5440/')
[ -n "$DB_URL" ] || { echo "no DB_URL from the app container" >&2; exit 1; }
export DB_URL
exec bun scripts/tools.ts "$@"