diff --git a/backend/config.py b/backend/config.py index 7dd21f9..aa6ca22 100644 --- a/backend/config.py +++ b/backend/config.py @@ -9,3 +9,6 @@ SHOULD_MOCK_AI_RESPONSE = bool(os.environ.get("MOCK", False)) # Set to True when running in production (on the hosted version) # Used as a feature flag to enable or disable certain features IS_PROD = os.environ.get("IS_PROD", False) + +# Hosted version only +BACKEND_SAAS_URL = os.environ.get("BACKEND_SAAS_URL", "") diff --git a/backend/routes/logging_utils.py b/backend/routes/logging_utils.py index 0de34fa..80e0f25 100644 --- a/backend/routes/logging_utils.py +++ b/backend/routes/logging_utils.py @@ -4,7 +4,7 @@ from openai.types.chat import ChatCompletionMessageParam from typing import List import json -from config import IS_PROD +from config import BACKEND_SAAS_URL, IS_PROD class PaymentMethod(Enum): @@ -23,8 +23,7 @@ async def send_to_saas_backend( ): if IS_PROD: async with httpx.AsyncClient() as client: - url = "https://screenshot-to-code-saas.onrender.com/generations/store" - # url = "http://localhost:8001/generations/store" + url = BACKEND_SAAS_URL + "/generations/store" data = json.dumps( { diff --git a/backend/routes/saas_utils.py b/backend/routes/saas_utils.py index c39124a..0802eaa 100644 --- a/backend/routes/saas_utils.py +++ b/backend/routes/saas_utils.py @@ -1,6 +1,8 @@ import httpx from pydantic import BaseModel +from config import BACKEND_SAAS_URL + class SubscriptionCreditsResponse(BaseModel): status: str @@ -10,8 +12,7 @@ async def does_user_have_subscription_credits( auth_token: str, ): async with httpx.AsyncClient() as client: - url = "https://screenshot-to-code-saas.onrender.com/credits/has_credits" - # url = "http://localhost:8001/credits/has_credits" + url = BACKEND_SAAS_URL + "/credits/has_credits" headers = { "Content-Type": "application/json",