proxy-oidcv2/verify.sh
2025-12-03 21:38:43 +01:00

103 lines
2.8 KiB
Bash

#!/bin/bash
# Verification script to check if the project is properly set up
echo "🔍 Verifying Secure Proxy Setup..."
echo ""
ERRORS=0
# Check Node.js
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed"
ERRORS=$((ERRORS+1))
else
echo "✓ Node.js: $(node --version)"
fi
# Check npm
if ! command -v npm &> /dev/null; then
echo "❌ npm is not installed"
ERRORS=$((ERRORS+1))
else
echo "✓ npm: $(npm --version)"
fi
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
echo "⚠️ node_modules not found - run 'npm install' first"
else
echo "✓ node_modules directory exists"
fi
# Check if .env exists
if [ ! -f ".env" ]; then
echo "⚠️ .env file not found - using defaults"
else
echo "✓ .env file exists"
fi
# Check if db directory exists
if [ ! -d "db" ]; then
echo "⚠️ db directory not found - will be created on first run"
else
echo "✓ db directory exists"
fi
# Check if sessions directory exists
if [ ! -d "sessions" ]; then
echo "⚠️ sessions directory not found - will be created on first run"
else
echo "✓ sessions directory exists"
fi
# Check if database exists
if [ -f "db/services.db" ]; then
echo "✓ Database initialized (db/services.db)"
else
echo "⚠️ Database not initialized - run 'npm run init-db'"
fi
# Check key source files
FILES=(
"src/server.js"
"src/config.js"
"src/db.js"
"public/admin.html"
"package.json"
)
echo ""
echo "Checking key files..."
for file in "${FILES[@]}"; do
if [ -f "$file" ]; then
echo "$file"
else
echo "$file (missing!)"
ERRORS=$((ERRORS+1))
fi
done
echo ""
if [ $ERRORS -eq 0 ]; then
echo "════════════════════════════════════════════════════════"
echo "✅ All checks passed! Ready to go."
echo ""
echo "Start the server with:"
echo " npm run dev"
echo ""
echo "Then open: http://localhost:3000"
echo "════════════════════════════════════════════════════════"
exit 0
else
echo "════════════════════════════════════════════════════════"
echo "⚠️ Some issues found. Please fix them first."
echo ""
echo "Common fixes:"
echo " - Install Node.js from https://nodejs.org"
echo " - Run: npm install"
echo " - Run: npm run init-db"
echo "════════════════════════════════════════════════════════"
exit 1
fi