mirror of
http://88.130.71.182:3000/BlitTech/contexta_be.git
synced 2026-06-12 23:23:21 +00:00
fixed bugs
This commit is contained in:
25
app/database.py
Normal file
25
app/database.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from supabase import create_client, Client
|
||||
from app.config import settings
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_supabase_client: Client = None
|
||||
|
||||
|
||||
def get_supabase() -> Client:
|
||||
global _supabase_client
|
||||
if _supabase_client is None:
|
||||
_supabase_client = create_client(
|
||||
settings.supabase_url,
|
||||
settings.supabase_service_role_key,
|
||||
)
|
||||
return _supabase_client
|
||||
|
||||
|
||||
def get_supabase_anon() -> Client:
|
||||
"""For user-scoped operations (respects RLS)"""
|
||||
return create_client(
|
||||
settings.supabase_url,
|
||||
settings.supabase_anon_key,
|
||||
)
|
||||
Reference in New Issue
Block a user