Skip to content

Environment variables

ZPA credentials

Required. The backend will not start without these.

VarPurpose
ZPA_CLIENT_IDOAuth client ID (ZIdentity)
ZPA_CLIENT_SECRETOAuth client secret
ZPA_CUSTOMER_IDNumeric customer ID
ZPA_VANITYVanity domain (the part before .zslogin.net)
ZPA_IDPDefault IdP ID for SCIM operand resolution

example.env in the repo root has the empty shape. Copy to .env, fill in, source it before running the binary.

Identity / proxy trust

VarDefaultPurpose
TRUSTED_PROXIESemptyComma-separated CIDRs of proxies allowed to set Remote-User, Remote-Email, Remote-Groups, Remote-Name. Anything else gets the headers stripped before any handler sees them.

In the Docker stack this is set to 172.16.0.0/12,10.0.0.0/8 (covers Docker bridge networks). On native runs you usually leave it empty - no proxy in front, no identity headers trusted.

Logging

VarDefaultPurpose
LOG_DIR${XDG_CONFIG_HOME}/painscaler/logsWhere rotated JSONL lands
LOG_FILEpainscaler.logFilename inside LOG_DIR
LOG_LEVELinfodebug / info / warn / error
LOG_MAX_SIZE_MB50Rotate when file exceeds this
LOG_MAX_BACKUPS10Keep this many rotated files
LOG_MAX_AGE_DAYS30Delete rotated files older than this
LOG_COMPRESStrueGzip rotated files

Errors are also mirrored to stderr regardless of LOG_LEVEL, so docker logs painscaler-api always surfaces them.

Storage

The simulation history SQLite DB lives at:

${XDG_CONFIG_HOME}/painscaler/runs.db

In the Docker image, XDG_CONFIG_HOME is set to /data, so the actual path is /data/painscaler/runs.db on the painscaler_data named volume. Logs land beside it at /data/logs/painscaler.log.

Frontend (build-time)

Vite reads from frontend/.env:

VarPurpose
VITE_API_BASEIf set, the dev proxy + production fetch base. Default is /api.

Not env vars, but configuration

  • Authelia secrets are generated by make init in deploy/ and live in deploy/secrets/ (mode 600, gitignored). Rotate with make rotate.
  • Caddy local CA is generated on first start, persisted in the caddy_data volume. Extract with make ca.