✨ Allow disabling docs UIs by disabling OpenAPI (#1421)

* ✨ Allow disabling docs UIs by disabling openapi_url

* 📝 Add docs for disabling OpenAPI and docs in prod or other environments

* ✅ Add tests for disabling OpenAPI and docs
This commit is contained in:
Sebastián Ramírez authored and GitHub committed 2020-05-16 17:45:12 +02:00
1 parent cfb72eec5a
commit 409264960e
7 files changed
+122 -4

No files matched your search

@@ -0,0 +1,16 @@
from fastapi import FastAPI
from pydantic import BaseSettings
class Settings(BaseSettings):
openapi_url: str = "/openapi.json"
settings = Settings()
app = FastAPI(openapi_url=settings.openapi_url)
@app.get("/")
def root():
return {"message": "Hello World"}