Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environment variables

SheetBot reads environment variables at startup. Restart the server after changing them.

Server

VariableDefaultPurpose
SHEETBOT_PORT3000HTTP port. Overridden by --port/-p.
SHEETBOT_HTTPS_PORT443HTTPS port, used when key.pem and cert.pem exist. Overridden by --https-port/-P.
NODE_ENVunsetSet to production in deployments.
SHEETBOT_WIDGET_CACHE_TTL5Minutes to cache /widgets.json. 0 disables caching.

Search paths

Search paths are colon-separated lists. Relative paths are resolved from the server’s working directory. Missing directories are skipped with a warning.

VariableAdds
SHEETBOT_INIT_SEARCH_PATHSExtra directories for startup init scripts. ./init/ is always searched first.
SHEETBOT_LIBRARY_SEARCH_PATHExtra directories for library task scripts. ./library/ is always searched first. Note the singular PATH.
SHEETBOT_SCRIPTS_SEARCH_PATHSExtra directories served at /scripts alongside ./scripts.
SHEETBOT_STATIC_SEARCH_PATHSExtra static directories served alongside ./static. Also scanned for widget-*.js.
SHEETBOT_MIDDLEWARE_SEARCH_PATHSExtra directories for setupMiddleware / setupPostRouteMiddleware modules.
SHEETBOT_EVENTHANDLER_SEARCH_PATHSExtra directories for setupEventHandlers modules.

Example:

export SHEETBOT_LIBRARY_SEARCH_PATH="/opt/sheetbot/library:$HOME/sheetbot/library"
export SHEETBOT_STATIC_SEARCH_PATHS="/opt/sheetbot/widgets"
export SHEETBOT_INIT_SEARCH_PATHS="/etc/sheetbot/init"

Agent and client

These are read by agent templates and task scripts. They are not server settings.

VariablePurpose
SHEETBOT_BASEURLSheetBot origin, for example http://localhost:3000. If omitted in an agent, the template fills in the origin that served it.
SHEETBOT_AUTH_USERUsername for agent login.
SHEETBOT_AUTH_PASSPassword for agent login.
SHEETBOT_AUTH_APIKEYAPI key for agent login. Takes precedence over username/password.
SHEETBOT_AUTHORIZATION_HEADERInjected into task scripts by the agent; contains Bearer <token>.
SHEETBOT_TASK_IDInjected into task scripts: the current task ID.
SHEETBOT_TASK_BASEURLInjected: GET the current task.
SHEETBOT_TASK_ACCEPTURLInjected: accept endpoint.
SHEETBOT_TASK_COMPLETEURLInjected: complete endpoint.
SHEETBOT_TASK_FAILEDURLInjected: fail endpoint.
SHEETBOT_TASK_DATAURLInjected: update task data.
SHEETBOT_TASK_ARTEFACTURLInjected: upload task artefacts.

Example for an agent:

export SHEETBOT_BASEURL=http://localhost:3000
export SHEETBOT_AUTH_APIKEY=your.api.key

See Using API keys for agents.

Distributed runtime

The experimental distributed runtime falls back to the normal auth variables:

VariablePurpose
SHEETBOT_DISPATCH_AUTH_APIKEYAPI key used by the HTTP dispatcher. Falls back to SHEETBOT_AUTH_APIKEY.
SHEETBOT_DISPATCH_AUTH_USERUsername for the dispatcher. Falls back to SHEETBOT_AUTH_USER.
SHEETBOT_DISPATCH_AUTH_PASSPassword for the dispatcher. Falls back to SHEETBOT_AUTH_PASS.

Precedence and notes

  • Agent authentication prefers SHEETBOT_AUTH_APIKEY, then username/password. Unset user/password when using a key.
  • Server CLI flags --port/-p and --https-port/-P override their environment variables.
  • Init scripts run in lexicographic order per directory; ./init/ runs before additional directories.
  • Widget discovery scans static directories once per cache window; restart or set SHEETBOT_WIDGET_CACHE_TTL=0 when developing widgets.
  • Env files are a shell/systemd/launchd concern, not a SheetBot feature. Do not commit secrets.

Next