furt/furt-lua/scripts/cleanup_debug.sh
michael 901f5eb2d8 feat(auth): implement complete API-key authentication with modular architecture (#47)
- Add comprehensive API-key authentication system with X-API-Key header validation
- Implement permission-based access control (mail:send, * for admin)
- Add rate-limiting system (60 req/hour per API key, 100 req/hour per IP)
- Refactor monolithic 590-line main.lua into 6 modular components (<200 lines each)
- Add IP-restriction support with CIDR notation (127.0.0.1, 10.0.0.0/8)
- Implement Hugo integration with CORS support for localhost:1313
- Add production-ready configuration with environment variable support
- Create comprehensive testing suite (auth, rate-limiting, stress tests)
- Add production deployment checklist and cleanup scripts

This refactoring transforms the API gateway from a single-file monolith into a
biocodie-compliant modular architecture while adding enterprise-grade security
features. Performance testing shows 79 RPS concurrent throughput with <100ms
latency. Hugo contact form integration tested and working. System is now
production-ready for deployment to walter/aitvaras.

Resolves #47
2025-06-24 22:01:38 +02:00

61 lines
2 KiB
Bash

#!/bin/bash
# furt-lua/scripts/cleanup_debug.sh
# Clean up debug code and prepare for production
echo "🧹 Cleaning up debug code for production..."
# Remove debug config script
if [ -f "debug_config.lua" ]; then
rm debug_config.lua
echo "✅ Removed debug_config.lua"
fi
# Check for any remaining DEBUG statements
echo -e "\n🔍 Checking for remaining DEBUG statements:"
debug_files=$(grep -r "DEBUG:" src/ 2>/dev/null || true)
if [ -n "$debug_files" ]; then
echo "⚠️ Found DEBUG statements:"
echo "$debug_files"
echo "Please remove these manually!"
else
echo "✅ No DEBUG statements found"
fi
# Check for any console.log or print statements that might be debug
echo -e "\n🔍 Checking for debug print statements:"
print_files=$(grep -r "print(" src/ | grep -v "-- Allow print" | grep -v "print.*error" || true)
if [ -n "$print_files" ]; then
echo "⚠️ Found print statements (review if needed for production):"
echo "$print_files"
else
echo "✅ No debug print statements found"
fi
# Check test endpoint (should be disabled in production)
echo -e "\n🔍 Checking for test endpoints:"
test_endpoints=$(grep -r "/test" src/ || true)
if [ -n "$test_endpoints" ]; then
echo "⚠️ Found test endpoints (disable in production):"
echo "$test_endpoints"
else
echo "✅ No test endpoints found"
fi
# Verify API keys are not hardcoded
echo -e "\n🔍 Checking for hardcoded API keys:"
hardcoded_keys=$(grep -r "change-me-in-production" config/ src/ || true)
if [ -n "$hardcoded_keys" ]; then
echo "⚠️ Found development API keys (change for production):"
echo "$hardcoded_keys"
else
echo "✅ No hardcoded development keys found"
fi
echo -e "\n✅ Debug cleanup complete!"
echo "📋 Production checklist:"
echo " - [ ] Change API keys in .env"
echo " - [ ] Disable /test endpoint"
echo " - [ ] Set CORS_ALLOWED_ORIGINS for production"
echo " - [ ] Configure production SMTP settings"
echo " - [ ] Review log levels"