Skip to content

Commit

Permalink
Moved testing endpoint to check settings inside of the admin router.
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartcampbell committed Oct 13, 2023
1 parent 67fcf43 commit 946c2d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 10 additions & 4 deletions nsls2api/api/v1/admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
import fastapi
from fastapi import Depends

from nsls2api.infrastructure import config
from nsls2api.infrastructure.security import validate_admin_role, generate_api_key
from nsls2api.models.apikeys import ApiUser

router = fastapi.APIRouter()
# router = fastapi.APIRouter(dependencies=[Depends(validate_admin_role)])
# router = fastapi.APIRouter()
router = fastapi.APIRouter(dependencies=[Depends(validate_admin_role)])


@router.get("/admin/settings")#, include_in_schema=False)
async def info(
settings: Annotated[config.Settings, Depends(config.get_settings)]
):
return settings
@router.get('/admim/validate', response_model=str)
async def check_admin_validation(admin_user: Annotated[ApiUser, Depends(validate_admin_role)]):
async def check_admin_validation(admin_user: Annotated[ApiUser, Depends(validate_admin_role)] = None):
"""
:param admin_user: Annotated[ApiUser, Depends(validate_admin_role)] - The admin user to be checked for validation.
:param admin_user: - The admin user to be checked for validation.
:return: str - The username of the validated admin user.
"""
return admin_user.username
Expand Down
6 changes: 0 additions & 6 deletions nsls2api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ def configure_routing():
)


@api.get("/info", include_in_schema=False)
async def info(
settings: Annotated[config.Settings, Depends(config.get_settings)]
):
return settings


@api.get("/healthy")
async def healthy():
Expand Down

0 comments on commit 946c2d7

Please sign in to comment.