Spaces:
Sleeping

axeronis commited on
Commit
0f84c85
·
1 Parent(s): 5097468

feat(storage): implement supabase storage for products with multi-tenant isolation

Browse files
Files changed (1) hide show
  1. backend/app/core/supabase.py +17 -0
backend/app/core/supabase.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from supabase import create_client, Client
3
+ from app.core.config import settings
4
+
5
+ def get_supabase_client() -> Client:
6
+ """
7
+ Get or create Supabase client.
8
+ """
9
+ if not settings.SUPABASE_URL or not settings.SUPABASE_KEY:
10
+ # In case env vars are missing, we might return None or raise error.
11
+ # For now, let's assume they exist if this is called.
12
+ raise RuntimeError("Supabase URL/KEY not configured")
13
+
14
+ return create_client(settings.SUPABASE_URL, settings.SUPABASE_KEY)
15
+
16
+ # Global accessibility
17
+ supabase_client = get_supabase_client() if (settings.SUPABASE_URL and settings.SUPABASE_KEY) else None