File size: 624 Bytes
6793beb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """
Supabase client initialization.
"""
from supabase import Client, create_client
from src.core.config import settings
from loguru import logger
def get_supabase() -> Client:
"""
Initialize and return a Supabase client.
"""
if not settings.SUPABASE_URL or not settings.SUPABASE_KEY:
logger.warning("Supabase credentials missing. Persistence will fail.")
# We don't crash here so the server can still start for local dev,
# but operations will fail.
return create_client(settings.SUPABASE_URL, settings.SUPABASE_KEY)
# Singleton instance
supabase: Client = get_supabase()
|