feat: Add supabase client skeleton

This commit is contained in:
Marty Oehme 2025-06-09 15:54:26 +02:00
parent 203aa79470
commit b80efc6d06
Signed by: Marty
GPG key ID: 4E535BC19C61886E
5 changed files with 515 additions and 14 deletions

View file

@ -20,3 +20,22 @@ class AiConfig:
raise ValueError(f"{API_KEY} cannot be empty")
return cls(**{"API_KEY": API_KEY})
@dataclass
class SupaConfig:
URL: str
KEY: str
@classmethod
def from_env(cls) -> "SupaConfig":
URL = os.getenv("SUPABASE_URL", "")
KEY = os.getenv("SUPABASE_KEY", "")
values: dict[str, str] = {"URL": URL, "KEY": KEY}
for name, val in values.items():
if not val:
raise ValueError(f"SUPABASE_{name} cannot be empty")
return cls(**values)

View file

@ -0,0 +1,10 @@
from supabase import Client, create_client
from prophet.config import SupaConfig
c = SupaConfig.from_env()
supabase: Client = create_client(c.URL, c.KEY)
if __name__ == "__main__":
print(supabase)