Merge pull request #777 from langflow-ai/add-docling-serve-env-var
feat: new env var to override docling serve host
This commit is contained in:
commit
355b737c17
2 changed files with 14 additions and 3 deletions
|
|
@ -66,6 +66,10 @@ EMBEDDING_MODEL=
|
||||||
# OPTIONAL url for openrag link to langflow in the UI
|
# OPTIONAL url for openrag link to langflow in the UI
|
||||||
LANGFLOW_PUBLIC_URL=
|
LANGFLOW_PUBLIC_URL=
|
||||||
|
|
||||||
|
# OPTIONAL: Override the full docling-serve URL (e.g., for remote instances)
|
||||||
|
# If not set, auto-detects host and uses port 5001
|
||||||
|
# DOCLING_SERVE_URL=http://my-docling-server:5001
|
||||||
|
|
||||||
# OPTIONAL: Override host for docling service (for special networking setups)
|
# OPTIONAL: Override host for docling service (for special networking setups)
|
||||||
# HOST_DOCKER_INTERNAL=host.containers.internal
|
# HOST_DOCKER_INTERNAL=host.containers.internal
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"""Docling service proxy endpoints."""
|
"""Docling service proxy endpoints."""
|
||||||
|
|
||||||
|
import os
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
@ -73,9 +74,15 @@ def determine_docling_host() -> str:
|
||||||
return "localhost"
|
return "localhost"
|
||||||
|
|
||||||
|
|
||||||
# Detect the host IP once at startup
|
# Use explicit URL if provided, otherwise auto-detect host
|
||||||
HOST_IP = determine_docling_host()
|
_docling_url_override = os.getenv("DOCLING_SERVE_URL")
|
||||||
DOCLING_SERVICE_URL = f"http://{HOST_IP}:5001"
|
if _docling_url_override:
|
||||||
|
DOCLING_SERVICE_URL = _docling_url_override.rstrip("/")
|
||||||
|
HOST_IP = _docling_url_override # For display in health responses
|
||||||
|
logger.info("Using DOCLING_SERVE_URL override: %s", DOCLING_SERVICE_URL)
|
||||||
|
else:
|
||||||
|
HOST_IP = determine_docling_host()
|
||||||
|
DOCLING_SERVICE_URL = f"http://{HOST_IP}:5001"
|
||||||
|
|
||||||
|
|
||||||
async def health(request: Request) -> JSONResponse:
|
async def health(request: Request) -> JSONResponse:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue