-
Couldn't load subscription status.
- Fork 116
Description
Hi all,
I need to have multiple instances of this api under the same fastAPI and I'm trying to understand why base_url has been used to generate urls not using also:
f"{base_url}/{request.scope.get("root_path")}
This is preventing me to mount the application under a specific fastAPI path: all the generated urls are not shipping the root_path infact.
It works with a fixed prefix but it is kind of hardcoded routing base url which prevents me to properly use fastAPI with this library.
It would be great if we could centralise the base url management here to also use the root_path from the scope:
def get_base_url(request: Request) -> str:
My goal is to mount multiple times this library to be able to have a first level of catalogs in a single application:
"links": [
{
"rel": "self",
"type": "application/json",
"href": "http://localhost:8080/catalogs/catalog_1/"
},
{
"rel": "root",
"type": "application/json",
"href": "http://localhost:8080/catalogs/catalog_1/"
},
{
"rel": "data",
"type": "application/json",
"href": "http://localhost:8080/catalogs/catalog_1/collections"
},
{
"rel": "conformance",
"type": "application/json",
"title": "STAC/WFS3 conformance classes implemented by this server",
"href": "http://localhost:8080/catalogs/catalog_1/conformance"
},
{
"rel": "search",
"type": "application/geo+json",
"title": "STAC search",
"href": "http://localhost:8080/catalogs/catalog_1/search",
"method": "GET"
},
Related problem:
stac-utils/stac-fastapi-elasticsearch-opensearch#308 (comment)
Related questions: why we are using the state of the application to save it?
app.state.router_prefix=....
What do you think?