Skip to content

The contexts file

The catalog of contexts the app server works with. Why the catalog lives on the server, and how health and the write gate work: Contexts and the write gate.

The catalog

The contexts are a catalog kept on the app server, never in the browser:

Where the app runs The catalog
Deployed (app.virtufin.com) The server's contexts.toml, provisioned by the deployment (k3s-common role virtufin_app). Users cannot add contexts from the browser: an empty menu says No contexts: add them to contexts.toml on the app server.
Development (npm run dev) ~/.config/virtufin/api/contexts.toml, the same file the TUI and the notebooks read; VIRTUFIN_CONTEXTS_FILE names another.

The file is read on every request, so an edit takes effect without a restart. Each [[contexts]] table has:

Field Meaning
name The context's name (required).
api_host, api_port The api's address (required). The port may be the api's gRPC port: the server forwards over HTTP/2.
tls true: https:// (h2 over TLS); otherwise h2c in plain text.
api_key Sent to the api as x-api-key. Without one, the server's VIRTUFIN_API_KEY is used.
description Shown under the name in the context menu.
protected true for a context where a mistake costs: every write asks first (see below).

An entry without name, api_host or api_port is left out; the context menu lists the problem (e.g. context foo: no api_port; left out), as it does for an unreadable file.