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:
parent
8f046ad0c5
commit
c4ab8c27ef
3 changed files with 256 additions and 46 deletions
24
views_api.py
24
views_api.py
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue