mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-25 07:08:11 -05:00
* 🔧 Update pre-commit, use ruff format * ⬆️ Upgrade dependencies, use Ruff for formatting * 🔧 Update Ruff config * 🔨 Update lint and format scripts, use Ruff * 🎨 Format internals with Ruff * 🎨 Format docs scripts * 🎨 Format tests * 🎨 Format extra commas in src for docs * 📝 Update docs mentioning `@lru_cache()`, use `@lru_cache` instead to keep consistency with the format * 🎨 Update src for docs, use plain `@lru_cache` * 🎨 Update src for docs format and docs references
22 lines
412 B
Python
22 lines
412 B
Python
from functools import lru_cache
|
|
|
|
from fastapi import Depends, FastAPI
|
|
|
|
from . import config
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@lru_cache
|
|
def get_settings():
|
|
return config.Settings()
|
|
|
|
|
|
@app.get("/info")
|
|
async def info(settings: config.Settings = Depends(get_settings)):
|
|
return {
|
|
"app_name": settings.app_name,
|
|
"admin_email": settings.admin_email,
|
|
"items_per_user": settings.items_per_user,
|
|
}
|