Files
BanGUI/backend/app/utils/setup_state.py

25 lines
801 B
Python

"""Manage the cached setup completion flag stored on application state."""
from __future__ import annotations
from fastapi import FastAPI
def is_setup_complete_cached(app: FastAPI) -> bool:
"""Return the cached setup completion state from application state."""
return getattr(app.state, "setup_complete_cached", False)
def set_setup_complete_cache(app: FastAPI, completed: bool) -> None:
"""Set the cached setup completion state on application state."""
app.state.setup_complete_cached = completed
def invalidate_setup_complete_cache(app: FastAPI) -> None:
"""Reset the cached setup completion state.
This helper exists so the cache can be invalidated explicitly if the
application state changes during runtime.
"""
app.state.setup_complete_cached = False