File size: 576 Bytes
fe74af2
 
 
 
9da3dbe
fe74af2
 
 
 
 
 
 
 
 
 
 
 
f6ee848
fe74af2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from supabase import create_client
from typing import Optional
from functools import lru_cache
from dotenv import load_dotenv
from pydantic import BaseModel
load_dotenv()
import os

@lru_cache(maxsize=1)
class Supabase_Settings(BaseModel):
    SUPABASE_URL: str = os.getenv("SUPABASE_URL")
    SUPABASE_ANON_KEY: str = os.getenv("SUPABASE_ANON_KEY")
    SUPABASE_SERVICE_KEY: str = os.getenv("SUPABASE_SERVICE_KEY")



@lru_cache(maxsize=1)
class Supabase_Client:
    values = Supabase_Settings()
    instance = create_client(values.SUPABASE_URL, values.SUPABASE_SERVICE_KEY)