Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1004 Bytes

File metadata and controls

48 lines (34 loc) · 1004 Bytes

FastAPI Integration

Live configuration in a FastAPI web server using AsyncConfigWatcher as a lifespan dependency.

What it shows

  • AsyncConfigWatcher started/stopped via FastAPI lifespan
  • field.value in route handlers — always fresh, no polling
  • Feature flags and server config as separate endpoints

Run

cd examples
make setup
pip install fastapi uvicorn
cd fastapi-integration
python main.py

Then:

curl http://localhost:8000/config
curl http://localhost:8000/features

Change a value and refresh:

decree config set <tenant-id> features.dark_mode false
curl http://localhost:8000/features

Dependencies

This example requires fastapi and uvicorn in addition to opendecree:

pip install opendecree fastapi uvicorn

Next

Learn more