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)
|
# Set to True when running in production (on the hosted version)
|
||||||
# Used as a feature flag to enable or disable certain features
|
# Used as a feature flag to enable or disable certain features
|
||||||
IS_PROD = os.environ.get("IS_PROD", False)
|
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
|
from typing import List
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from config import IS_PROD
|
from config import BACKEND_SAAS_URL, IS_PROD
|
||||||
|
|
||||||
|
|
||||||
class PaymentMethod(Enum):
|
class PaymentMethod(Enum):
|
||||||
@ -23,8 +23,7 @@ async def send_to_saas_backend(
|
|||||||
):
|
):
|
||||||
if IS_PROD:
|
if IS_PROD:
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
url = "https://screenshot-to-code-saas.onrender.com/generations/store"
|
url = BACKEND_SAAS_URL + "/generations/store"
|
||||||
# url = "http://localhost:8001/generations/store"
|
|
||||||
|
|
||||||
data = json.dumps(
|
data = json.dumps(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import httpx
|
import httpx
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from config import BACKEND_SAAS_URL
|
||||||
|
|
||||||
|
|
||||||
class SubscriptionCreditsResponse(BaseModel):
|
class SubscriptionCreditsResponse(BaseModel):
|
||||||
status: str
|
status: str
|
||||||
@ -10,8 +12,7 @@ async def does_user_have_subscription_credits(
|
|||||||
auth_token: str,
|
auth_token: str,
|
||||||
):
|
):
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
url = "https://screenshot-to-code-saas.onrender.com/credits/has_credits"
|
url = BACKEND_SAAS_URL + "/credits/has_credits"
|
||||||
# url = "http://localhost:8001/credits/has_credits"
|
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user