File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77from fastapi .middleware .cors import CORSMiddleware
88from fastapi .responses import FileResponse , HTMLResponse
99from fastapi .staticfiles import StaticFiles
10+ from urllib .parse import urlparse
1011
1112# Load environment variables from .env file
1213load_dotenv ()
@@ -40,14 +41,21 @@ async def get_config():
4041 backend_url = os .getenv ("BACKEND_API_URL" , "http://localhost:8000" )
4142 auth_enabled = os .getenv ("AUTH_ENABLED" , "false" )
4243
43- # Validate backend_url is a proper URL
44- if not backend_url .startswith (("http://" , "https://" )):
44+ # Validate backend_url is a proper URL with scheme and netloc
45+ try :
46+ parsed = urlparse (backend_url )
47+ if not (parsed .scheme in ["http" , "https" ] and parsed .netloc ):
48+ backend_url = "http://localhost:8000"
49+ except Exception :
4550 backend_url = "http://localhost:8000"
4651
4752 backend_url = backend_url + "/api"
4853
4954 # Validate auth_enabled is a boolean string
50- auth_enabled = auth_enabled .lower () if auth_enabled .lower () in ["true" , "false" ] else "false"
55+ if auth_enabled and auth_enabled .lower () in ["true" , "false" ]:
56+ auth_enabled = auth_enabled .lower ()
57+ else :
58+ auth_enabled = "false"
5159
5260 config = {
5361 "API_URL" : backend_url ,
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import "./../../styles/HomeInput.css";
1717import { HomeInputProps , iconMap , QuickTask } from "../../models/homeInput" ;
1818import { TaskService } from "../../services/TaskService" ;
1919import { NewTaskService } from "../../services/NewTaskService" ;
20- import { RAIErrorCard , RAIErrorData } from "../errors" ;
2120
2221import ChatInput from "@/coral/modules/ChatInput" ;
2322import InlineToaster , { useInlineToaster } from "../toast/InlineToaster" ;
You can’t perform that action at this time.
0 commit comments