Files
assetx/webapp-back/start.sh

25 lines
652 B
Bash
Raw Permalink Normal View History

#!/bin/bash
echo "========================================="
echo "AssetX API Server"
echo "========================================="
# Load environment variables
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
fi
# Check if MySQL is running (optional)
echo "Checking MySQL connection..."
mysql -h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PASSWORD -e "SELECT 1" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "✓ MySQL connection successful"
else
echo "⚠ MySQL connection failed - using SQLite"
export DB_TYPE=sqlite
fi
# Run the application
echo "Starting server on port $PORT..."
go run main.go