Skip to content

Commit

Permalink
修复fastapi配置变量命名和类型 (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-clan authored Feb 8, 2025
1 parent 04ac845 commit 3e05034
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions backend/core/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ class Settings(BaseSettings):
FASTAPI_TITLE: str = 'FastAPI'
FASTAPI_VERSION: str = '0.0.1'
FASTAPI_DESCRIPTION: str = 'FastAPI Best Architecture'
FASTAPI_DOCS_URL: str | None = '/docs'
FASTAPI_REDOCS_URL: str | None = '/redocs'
FASTAPI_DOCS_URL: str = '/docs'
FASTAPI_REDOC_URL: str = '/redoc'
FASTAPI_OPENAPI_URL: str | None = '/openapi'
FASTAPI_STATIC_FILES: bool = False

@model_validator(mode='before')
@classmethod
def validator_api_url(cls, values):
if values['ENVIRONMENT'] == 'pro':
values['OPENAPI_URL'] = None
values['FASTAPI_OPENAPI_URL'] = None
values['FASTAPI_STATIC_FILES'] = False
return values

Expand Down
2 changes: 1 addition & 1 deletion backend/core/registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def register_app():
version=settings.FASTAPI_VERSION,
description=settings.FASTAPI_DESCRIPTION,
docs_url=settings.FASTAPI_DOCS_URL,
redoc_url=settings.FASTAPI_REDOCS_URL,
redoc_url=settings.FASTAPI_REDOC_URL,
openapi_url=settings.FASTAPI_OPENAPI_URL,
lifespan=register_init,
)
Expand Down

0 comments on commit 3e05034

Please sign in to comment.