File size: 1,046 Bytes
96e3bef
6ac7786
 
96e3bef
6ac7786
 
 
 
96e3bef
6ac7786
 
 
 
 
 
 
 
 
 
 
 
 
 
96e3bef
6ac7786
 
 
e2642a5
6ac7786
 
 
96e3bef
 
6ac7786
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
import time
import os
from fastrtc import get_cloudflare_turn_credentials

def main():
    print("\n" + "="*40)
    print(" 🔍 DEBUG: Fetching Cloudflare TURN Credentials")
    print("="*40 + "\n")

    try:
        # get_cloudflare_turn_credentials relies on the HF_TOKEN environment variable.
        # This is automatically provided in Hugging Face Spaces.
        creds = get_cloudflare_turn_credentials()
        
        print("✅ Success! Here is the RTC Configuration:")
        print("-" * 20)
        print(creds)
        print("-" * 20)
        
    except Exception as e:
        print("❌ Error fetching credentials.")
        print(f"Details: {e}")
        print("\nPossible fix: Ensure 'HF_TOKEN' is set in your Space secrets.")

    print("\n" + "="*40)
    print(" 💤 Script sleeping... Check the 'Logs' tab to see the output above.")
    print("="*40 + "\n")

    # Keep the Space running so you can read the logs without it crashing/restarting
    while True:
        time.sleep(60)

if __name__ == "__main__":
    main()