mirror of
http://88.130.71.182:3000/BlitTech/deals24togo_be.git
synced 2026-06-12 23:33:21 +00:00
24 lines
624 B
Python
24 lines
624 B
Python
"""Supabase client helpers — one anon client, one service-role client."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from functools import lru_cache
|
|
|
|
from supabase import Client, create_client
|
|
|
|
from app.core.config import get_settings
|
|
|
|
|
|
@lru_cache
|
|
def get_supabase_client() -> Client:
|
|
"""Public / anon client — respects RLS policies."""
|
|
s = get_settings()
|
|
return create_client(s.SUPABASE_URL, s.SUPABASE_KEY)
|
|
|
|
|
|
@lru_cache
|
|
def get_supabase_admin() -> Client:
|
|
"""Service-role client — bypasses RLS. Use with care."""
|
|
s = get_settings()
|
|
return create_client(s.SUPABASE_URL, s.SUPABASE_SERVICE_ROLE_KEY)
|