Skip to content

Configuration Reference

Every setting Squirrel reads, in one place.

config.json

config.json lists the Canopy servers Squirrel can connect to, called instances:

{
  "instances": {
    "canopy-local": { "apiUrl": "http://localhost:8080" },
    "production": {
      "apiUrl": "http://canopy.example.org:8080",
      "apiKey": "<shared key>"
    }
  }
}
Field Required Meaning
apiUrl Yes The Canopy server's base URL. Squirrel adds the Canopy paths (such as /squirrel/v1 and /hare/v1) to it.
apiKey No A key shared by every user of this instance; see Shared Key for the Desktop App.

With one instance, Squirrel connects to it straight away. With several, it asks which to use, unless one is named with --instance.

Where it is read from

Runs in Looks in, in order
Desktop app 1. The file named by SQUIRREL_CONFIG
2. The config.json bundled with the app
3. /config.json, as in a web browser
Web browser config.json, served alongside the page. Without it, Squirrel uses no instances and sends requests to the page's own server

Release builds bundle a config.json that lists only canopy-local, so a deployed site lists its own instances in a site config named by SQUIRREL_CONFIG.

Squirrel uses the first file it can read and parse. If SQUIRREL_CONFIG is set but the file can't be read, or isn't valid JSON, the problem is logged and Squirrel falls back to the bundled file. See Site config location for where to keep it.

Command Line

Option Meaning
--instance <name>, -i <name> Connect to this instance from config.json, without asking. A name that isn't in config.json is ignored, and Squirrel asks as usual.

Environment Variables

Desktop app

Variable Meaning
SQUIRREL_CONFIG Path of the site config.json
APPDIR Where the app was extracted, if not under /usr; see Launch Environment
WEBKIT_DISABLE_COMPOSITING_MODE=1 Needed when displaying over ssh -X

Building the app

Variable Meaning
VITE_API_URL A Canopy base URL built into the app, used when no instance is selected. Empty by default, meaning "the page's own server".
VITE_BASE_PATH The path the app is served under, such as /squirrel/. Defaults to /; the web container image builds for /squirrel/.

Web container image

Variable Meaning
CANOPY_UPSTREAM Required. The Canopy server nginx forwards to; see Deploying the Web App
CANOPY_API_KEY Required. The API key nginx adds to every request it forwards

Development server

Read from .env.local by pnpm dev; see Local Setup.

Variable Meaning
API_KEY Required. The API key the dev server adds to every request it forwards to Canopy.
CANOPY_URL The Canopy server to forward to. Defaults to http://localhost:8080.

Per-User Settings

Each user's API keys, one per instance, are saved:

Runs in Where
Desktop app settings.json in the app's data directory, e.g. ~/.local/share/edu.stanford.slac.squirrel/settings.json on Linux
Web browser The browser's localStorage

Both store keys in plain text. Other preferences, such as light or dark mode, are kept in the browser engine's local storage. Admin mode isn't saved; it is off each time Squirrel starts.