File size: 1,704 Bytes
4e3c158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

import asyncio
import os
from pathlib import Path
import sys
import httpx

# Add backend to path
sys.path.append(str(Path(__file__).parent.parent))

from integrations.salesforce_routes import get_salesforce_client_from_env
from integrations.slack_routes import get_slack_client


async def verify_system():
    print("\n--- Final System Verification ---")
    
    # 1. Check Environment Variables
    print("\n1. Checking Critical Environment Variables:")
    critical_vars = ["SECRET_KEY", "ENVIRONMENT"]
    for var in critical_vars:
        val = os.getenv(var)
        status = "✅ Present" if val else "❌ Missing"
        print(f"   - {var}: {status}")

    # 2. Check Integration Clients (Graceful Failure)
    print("\n2. Checking Integration Clients:")
    try:
        sf_client = get_salesforce_client_from_env()
        print(f"   - Salesforce: {'✅ Connected' if sf_client else 'ℹ️ Not Configured (Expected)'}")
    except Exception as e:
        print(f"   - Salesforce: ❌ Error ({e})")

    try:
        slack_client = get_slack_client()
        print(f"   - Slack: {'✅ Connected' if slack_client else 'ℹ️ Not Configured (Expected)'}")
    except Exception as e:
        print(f"   - Slack: ❌ Error ({e})")

    # 3. Check Backend Importability
    print("\n3. Checking Backend Importability:")
    try:
        from main_api_app import app
        print("   - main_api_app: ✅ Imported successfully")
    except ImportError as e:
        print(f"   - main_api_app: ❌ Import Failed ({e})")
    except Exception as e:
        print(f"   - main_api_app: ❌ Error ({e})")

async def main():
    await verify_system()

if __name__ == "__main__":
    asyncio.run(main())