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 (image updates, share expiry, and session reconciliation)
live in lifespan.
attributelogger= logging.getLogger(__name__)attributeRECONCILE_INTERVAL= 30attributeapi_app= create_app()funcbackground_reconcile_job() -> NonePeriodically reconcile sessions with the backend.
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_proot_catalogs(_path) -> NoneWatcher callback: reload the PRoot Apps catalogs and bring this node's copies along.
param_pathstrReturns
Nonefunc_reload_vpn(_path) -> NoneWatcher callback: reload the VPN profiles after another node or an administrator changed them.
param_pathstrReturns
Nonefunc_reload_cluster(_path) -> NoneWatcher callback: reload the cluster's records after another node or an administrator changed them.
param_pathstrReturns
Nonefunc_sync_records() -> NoneBring this node and the shared records together: the root key, its own record, and the registry.
Returns
Nonefunc_catch_up() -> NoneFinish what a start without the store left undone, and read again everything it served from its copy.
Returns
Nonefuncbackground_peer_job() -> NoneAsk the other nodes for their sessions and load, over and over.
Returns
Nonefuncbackground_usage_job() -> NoneWrite this node's usage and sync the shared files of its running sessions, over and over.
Returns
Nonefunc_reload_users(_path) -> NoneWatcher callback: reload users and groups after an external edit.
param_pathstrReturns
Nonefunc_reload_branding(_path) -> NoneWatcher callback: take up the brand after an 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]func_conflict(_request, _exc) -> JSONResponseAnswer a write another node got in ahead of, after looking at what it wrote.
param_requestRequestparam_excExceptionReturns
fastapi.responses.JSONResponsefunc_unavailable(_request, exc) -> JSONResponseAnswer a write the store could not take.
param_requestRequestparamexcExceptionReturns
fastapi.responses.JSONResponsefunccreate_app() -> FastAPIBuild the FastAPI application with every router registered.
Returns
fastapi.FastAPIThe configured FastAPI instance.