File size: 563 Bytes
857d4f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from supabase import create_client

from app.core.config import SUPABASE_KEY, SUPABASE_URL

_supabase = None


def get_supabase_client():
    global _supabase

    if _supabase is not None:
        return _supabase

    if not SUPABASE_URL or not SUPABASE_KEY:
        print("⚠️ Supabase bilgileri .env içinde bulunamadı!")
        return None

    try:
        _supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
    except Exception as exc:
        print(f"⚠️ Supabase client oluşturulamadı: {exc}")
        _supabase = None

    return _supabase