Skip to content

Commit b9c7737

Browse files
authored
Use shared settings dependency in security helpers (#52)
1 parent 9e9e2fb commit b9c7737

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

backend/api/security.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@
1010
from fastapi.security import APIKeyHeader
1111
from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
1212

13-
from api.config import Settings
13+
from api.config import Settings, get_settings
1414

1515
# Write token (admin) auth
1616
api_key_header = APIKeyHeader(name="Authorization", auto_error=False)
1717

18-
19-
def get_settings() -> Settings:
20-
# Instantiate settings outside of Pydantic request validation to avoid DI issues.
21-
return Settings()
22-
23-
2418
async def require_write_token(
2519
authorization: str | None = Security(api_key_header),
2620
settings: Settings = Depends(get_settings),

0 commit comments

Comments
 (0)