Spaces:
Sleeping

File size: 1,233 Bytes
7937092
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import sys

BASE_URL = "http://localhost:8000"

def test_environment():
    print("--- Phase 1: Environment & Config Verification ---")
    try:
        # 1. Check FastAPI Backend
        print("[TEST] Pinging FastAPI Backend...")
        res = requests.get(f"{BASE_URL}/about")
        if res.status_code == 200:
            print("βœ… FastAPI is running.")
        else:
            print(f"❌ FastAPI Error: Status {res.status_code}")
            
        # 2. Check Config Endpoint (Validates .env loading)
        print("[TEST] Fetching Configuration...")
        res = requests.get(f"{BASE_URL}/config")
        config = res.json()
        if "pogsfhuwkfmmomphward" in config.get("supabase_url", ""):
            print("βœ… Supabase URL correctly loaded.")
        else:
            print("❌ Invalid Supabase URL loaded.")
            
        if config.get("supabase_anon_key").startswith("eyJhbGciOi"):
            print("βœ… Valid Supabase JWT Anon Key loaded.")
        else:
            print("❌ Invalid Supabase Anon Key detected.")
            
    except Exception as e:
        print(f"❌ Environment Test Failed: {str(e)}")
        sys.exit(1)

if __name__ == "__main__":
    test_environment()