Fixing automated goose script

This commit is contained in:
Finley Ghosh 2025-12-07 16:21:46 +11:00
parent 6668e1af4f
commit c4d60bc1c9

View file

@ -39,16 +39,14 @@ else
fi
# Load goose.env and override the port
GOOSE_ENV_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../go" && pwd)/goose.env"
if [ -f "$GOOSE_ENV_FILE" ]; then
cd go
if [ -f "goose.env" ]; then
echo "Loading configuration from goose.env..."
export $(grep -v '^#' "$GOOSE_ENV_FILE" | xargs)
export $(grep -v '^#' goose.env | xargs)
# Override the port in GOOSE_DBSTRING
export GOOSE_DBSTRING=$(echo "$GOOSE_DBSTRING" | sed "s/:3306/:$SSH_PORT/")
# Make migration dir absolute
export GOOSE_MIGRATION_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../go" && pwd)/$GOOSE_MIGRATION_DIR"
else
echo "ERROR: goose.env file not found at $GOOSE_ENV_FILE"
echo "ERROR: goose.env file not found"
pkill -f "ssh.*-L $SSH_PORT:localhost:$DB_PORT" || true
exit 1
fi