Skip to content

Commit

Permalink
Added a root_path config parameter that allows to configure the fasta…
Browse files Browse the repository at this point in the history
…pi app root_path.
  • Loading branch information
markus1978 committed Dec 22, 2020
1 parent e20407d commit 02306f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions optimade/server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ class ServerConfig(BaseSettings):
"test_server",
description="ID of /links endpoint resource for the chosen default OPTIMADE implementation (only relevant for the index meta-database)",
)
root_path: Optional[str] = Field(
None,
description=(
"Fastapi root_path app parameter. This can be used to serve the API under a "
"path prefix behind a proxy or as a sub application of another fastapi app."
),
)
base_url: Optional[str] = Field(
None, description="Base URL for this implementation"
)
Expand Down
1 change: 1 addition & 0 deletions optimade/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
LOGGER.info("DEBUG MODE")

app = FastAPI(
root_path=CONFIG.root_path,
title="OPTIMADE API",
description=(
f"""The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.
Expand Down

0 comments on commit 02306f8

Please sign in to comment.