settings for LANGFLOW_URL
This commit is contained in:
parent
8f9afa0950
commit
c97477a4ca
1 changed files with 25 additions and 0 deletions
25
src/api/settings.py
Normal file
25
src/api/settings.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import os
|
||||
from starlette.responses import JSONResponse
|
||||
from config.settings import LANGFLOW_URL, FLOW_ID, LANGFLOW_PUBLIC_URL
|
||||
|
||||
async def get_settings(request, session_manager):
|
||||
"""Get application settings"""
|
||||
try:
|
||||
# Return public settings that are safe to expose to frontend
|
||||
settings = {
|
||||
"langflow_url": LANGFLOW_URL,
|
||||
"flow_id": FLOW_ID,
|
||||
"langflow_public_url": LANGFLOW_PUBLIC_URL,
|
||||
}
|
||||
|
||||
# Only expose edit URL when a public URL is configured
|
||||
if LANGFLOW_PUBLIC_URL and FLOW_ID:
|
||||
settings["langflow_edit_url"] = f"{LANGFLOW_PUBLIC_URL.rstrip('/')}/flow/{FLOW_ID}"
|
||||
|
||||
return JSONResponse(settings)
|
||||
|
||||
except Exception as e:
|
||||
return JSONResponse(
|
||||
{"error": f"Failed to retrieve settings: {str(e)}"},
|
||||
status_code=500
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue