mirror of
http://88.130.71.182:3000/BlitTech/deals24togo_be.git
synced 2026-06-12 23:33:21 +00:00
Initial commit
This commit is contained in:
23
app/core/supabase.py
Normal file
23
app/core/supabase.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""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)
|
||||
Reference in New Issue
Block a user