#!/bin/bash # Load environment variables if [ -f .env ]; then # export $(grep -v '^#' .env | xargs) # Use a safer way if possible, but for simple .env this often works. # Better way to source .env without exporting everything to shell if we just want to use them in script: set -a source .env set +a fi if [ -z "$VPS_HOST" ] || [ -z "$VPS_USER" ]; then echo "Error: VPS_HOST and VPS_USER must be set in .env" echo "Please add them to your .env file:" echo "VPS_USER=your-username" echo "VPS_HOST=your-ip-address" exit 1 fi echo "🔮 Establishing secure tunnel to Drizzle Studio..." echo "" echo "📚 Open this URL in your browser:" echo " https://local.drizzle.studio?host=127.0.0.1&port=4983" echo "" echo "💡 Note: Drizzle Studio works via their proxy service, not direct localhost." echo "Press Ctrl+C to stop the connection." # -N means "Do not execute a remote command". -L is for local port forwarding. ssh -N -L 4983:127.0.0.1:4983 $VPS_USER@$VPS_HOST