Commit 41236f19 authored by BODERE's avatar BODERE
Browse files

fix: add root_path

parent 46fa2b87
Pipeline #6332 passed with stage
in 54 seconds
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -* # -*- coding: utf-8 -*
"""Opensearx configuration""" """Opensearx configuration"""
from starlette.config import Config
from starlette.templating import Jinja2Templates from starlette.templating import Jinja2Templates
from opensearx_ws.opensearch.engine import (IfremerOpensearchEngine, from opensearx_ws.opensearch.engine import (IfremerOpensearchEngine,
JPLOpensearchEngine) JPLOpensearchEngine)
config = Config()
SCRIPT_NAME = config("SCRIPT_NAME", default="")
# opensearch engines executed # opensearch engines executed
opensearch_engines = { opensearch_engines = {
"Opensearch Ifremer": "Opensearch Ifremer":
...@@ -20,3 +26,5 @@ opensearch_engines = { ...@@ -20,3 +26,5 @@ opensearch_engines = {
# jinja2 templates utility # jinja2 templates utility
j2_templates = Jinja2Templates(directory="templates") j2_templates = Jinja2Templates(directory="templates")
...@@ -14,12 +14,14 @@ from fastapi.responses import ORJSONResponse ...@@ -14,12 +14,14 @@ from fastapi.responses import ORJSONResponse
from starlette.requests import Request from starlette.requests import Request
from starlette.responses import JSONResponse, Response from starlette.responses import JSONResponse, Response
from opensearx_ws.config import j2_templates, opensearch_engines from opensearx_ws.config import j2_templates, opensearch_engines, SCRIPT_NAME
from opensearx_ws.opensearch import merge_opensearch_responses from opensearx_ws.opensearch import merge_opensearch_responses
from opensearx_ws.opensearch.model import (OpensearchQueryParameters, from opensearx_ws.opensearch.model import (OpensearchQueryParameters,
OpensearchResponseFormat) OpensearchResponseFormat)
app = FastAPI() app = FastAPI(
root_path=SCRIPT_NAME,
)
@app.get("/engines") @app.get("/engines")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment