Enhance SSH tunnel functionality in transaction processing: implement subprocess-based SSH tunnel as a fallback, improve error handling, and add detailed connection testing with step-by-step reporting. Update API to utilize new testing method and enhance UI to display detailed results.

This commit is contained in:
padreug 2025-06-18 15:33:51 +02:00
parent 8f046ad0c5
commit c4ab8c27ef
3 changed files with 256 additions and 46 deletions

View file

@ -325,26 +325,22 @@ async def api_update_deposit_status(
async def api_test_database_connection(
wallet: WalletTypeInfo = Depends(require_admin_key),
):
"""Test connection to Lamassu database"""
"""Test connection to Lamassu database with detailed reporting"""
try:
from .transaction_processor import transaction_processor
connection = await transaction_processor.connect_to_lamassu_db()
if connection:
await connection.close()
return {
"success": True,
"message": "Successfully connected to Lamassu database"
}
else:
return {
"success": False,
"message": "Failed to connect to Lamassu database. Check configuration."
}
# Use the detailed test method
result = await transaction_processor.test_connection_detailed()
return result
except Exception as e:
return {
"success": False,
"message": f"Database connection error: {str(e)}"
"message": f"Test connection error: {str(e)}",
"steps": [f"❌ Unexpected error: {str(e)}"],
"ssh_tunnel_used": False,
"ssh_tunnel_success": False,
"database_connection_success": False
}