Coverage for docs_src/settings/app02/main.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from functools import lru_cache 1abcde

2 

3from fastapi import Depends, FastAPI 1abcde

4 

5from .config import Settings 1abcde

6 

7app = FastAPI() 1abcde

8 

9 

10@lru_cache 1abcde

11def get_settings(): 1abcde

12 return Settings() 1abcde

13 

14 

15@app.get("/info") 1abcde

16async def info(settings: Settings = Depends(get_settings)): 1abcde

17 return { 1abcde

18 "app_name": settings.app_name, 

19 "admin_email": settings.admin_email, 

20 "items_per_user": settings.items_per_user, 

21 }