Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/common/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class Settings(BaseSettings):
extra="ignore",
)
PROJECT_NAME: str = "SQLBot"
API_V1_STR: str = "/api/v1"
#CONTEXT_PATH: str = "/sqlbot"
CONTEXT_PATH: str = ""
API_V1_STR: str = CONTEXT_PATH + "/api/v1"
SECRET_KEY: str = secrets.token_urlsafe(32)
# 60 minutes * 24 hours * 8 days = 8 days
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
Expand Down
7 changes: 7 additions & 0 deletions backend/common/utils/whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ def is_whitelisted(self, path: str) -> bool:
prefix = settings.API_V1_STR
if path.startswith(prefix):
path = path[len(prefix):]

context_prefix = settings.CONTEXT_PATH
if context_prefix and path.startswith(context_prefix):
path = path[len(context_prefix):]

if not path:
path = '/'
if path in self.whitelist:
return True

Expand Down
Loading