read BACKEND_SAAS_URL env var rather than hard-coded values
This commit is contained in:
parent
97591336c3
commit
f3ca39b40a
@ -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", "")
|
||||
|
||||
@ -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(
|
||||
{
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user