api
FastAPI application factory and lifespan.
The application object is created here and every router is registered. State
initialisation, cache refreshes, the configuration file watcher and the
background jobs live in lifespan.
attributelogger= logging.getLogger(__name__)attributeapi_app= create_app()func_remove_stale_sessions() -> NoneDrop persisted sessions whose containers no longer exist.
Returns
Nonefuncbackground_update_job() -> NonePeriodically refresh store caches, pull images and prune dangling ones.
Returns
Nonefuncbackground_share_cleanup_job() -> NonePeriodically delete expired public shares.
Returns
Nonefunc_reload_installed_apps(_path) -> NoneWatcher callback: reload installed apps after an external edit.
param_pathstrReturns
Nonefunc_reload_app_stores(_path) -> NoneWatcher callback: reload app stores after an external edit.
param_pathstrReturns
Nonefunc_reload_templates(_path) -> NoneWatcher callback: reload templates after an external edit.
param_pathstrReturns
Nonefunc_reload_users(_path) -> NoneWatcher callback: reload users and groups after an external edit.
param_pathstrReturns
Nonefunc_watch_targets() -> dict[str, persistence.ReloadCallback]Return the configuration paths to watch and their reload callbacks.
Returns
dict[str, app.persistence.app.persistence.ReloadCallback]func_warn_if_cert_expiring(days=14) -> NoneLog a warning when the proxy TLS certificate is expired or about to expire.
paramdaysint= 14Returns
Nonefunclifespan(app) -> AsyncIterator[None]Initialise state on startup and stop background tasks on shutdown.
paramappFastAPIReturns
collections.abc.AsyncIterator[None]funccreate_app() -> FastAPIBuild the FastAPI application with every router registered.
Returns
fastapi.FastAPIThe configured FastAPI instance.