Environment Variables
Everything Pinchy needs to run lives in one file next to your docker-compose.yml: a plain .env. This page lists every variable that file can contain, what it does, and what happens when you leave it out.
Only one is mandatory. Pinchy generates its own secrets on first start and persists them in Docker volumes, so a working install is two lines long:
PINCHY_VERSION=v0.10.3Required
Section titled “Required”| Variable | Default | What it does |
|---|---|---|
PINCHY_VERSION |
none | The image tag for all Pinchy containers, e.g. v0.10.3. Compose refuses to start without it, so the stack you run today is the one you pinned. |
Pinning is deliberate: an unpinned stack silently changes under you on the next docker compose pull. See Upgrading for moving between versions.
Network
Section titled “Network”| Variable | Default | What it does |
|---|---|---|
PINCHY_PORT |
127.0.0.1:7777 |
Where the web UI binds on the host. Pinchy always listens on 7777 inside the container. |
PINCHY_TRUSTED_PROXIES |
loopback | Proxy hops to look past when working out a visitor’s address. See below. |
Accepted forms are HOST_PORT (3000) or HOST_IP:HOST_PORT (0.0.0.0:80). Do not append the container port — Compose does that.
The default binds to localhost only, which means a fresh install is not reachable from the internet even if the host has a public IP. Change it only when something else terminates TLS in front of Pinchy:
# Reachable only from this machine (the default)PINCHY_PORT=127.0.0.1:7777
# All interfaces — only behind a reverse proxyPINCHY_PORT=0.0.0.0:80For a public deployment, read VPS Deployment and HTTPS & Domain Lock before widening this.
PINCHY_TRUSTED_PROXIES
Section titled “PINCHY_TRUSTED_PROXIES”Behind a reverse proxy, every request reaches Pinchy from the proxy — so the address on the connection is the proxy’s, and the visitor’s own address only exists in the X-Forwarded-For header. Pinchy uses that header to key the sign-in brute-force throttle, the WebSocket connection limit, and the clientAddress field on blocked-request entries in the audit trail.
A visitor can put anything in that header themselves, so Pinchy reads the last hop — the one your proxy appended, which the visitor had no say in. That works out of the box for the usual setup: one reverse proxy, directly in front of Pinchy.
Set this variable when something else sits in front of that proxy — Cloudflare, a load balancer, a second nginx — and name its addresses, so Pinchy walks past those hops too:
PINCHY_TRUSTED_PROXIES=10.0.0.0/8,173.245.48.0/20Comma-separated, each entry an IP address or a CIDR range. Loopback (127.0.0.0/8, ::1) is trusted whether or not you set this. An entry that is neither an address nor a range is ignored, with a warning at startup naming it.
Two things worth knowing:
- Your proxy has to add the visitor’s address. nginx does it with
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;; Caddy and Traefik do it by default. A proxy that forwards the visitor’s own header untouched hands Pinchy an address the visitor picked, and the sign-in throttle is only as trustworthy as that header. - Do not list your whole private network. On a company LAN the visitor’s real address is a
10.xor192.168.xone. Trusting the entire range makes Pinchy walk past the visitor too, and land on whatever hop they wrote in front of it. List the proxies, not the network they live in. - Keep a proxy in front. Pinchy cannot tell your proxy’s connection from a visitor’s, so it reads
X-Forwarded-Foron both. An install exposed straight to the internet (PINCHY_PORT=0.0.0.0:80, no reverse proxy) therefore takes that header from the visitor themselves, and the sign-in throttle follows an address they picked. The default127.0.0.1:7777bind is what prevents this, and a reverse proxy is needed for TLS anyway. See VPS Deployment.
If a hop is left untrusted, sign-ins arriving through it share one throttle bucket keyed to that hop — a nuisance rather than a hole, since the address is still one nobody can forge.
Secrets
Section titled “Secrets”Pinchy generates each of these on first start and persists it in the pinchy-secrets volume, so you can ignore all of them and still have a secure install. Set them explicitly when you want to own the credential — for backup, rotation, or restoring an install onto a new host.
| Variable | Default | What it does |
|---|---|---|
DB_PASSWORD |
pinchy_dev |
Password for the PostgreSQL pinchy user. See the note below — the development default never stays active. |
BETTER_AUTH_SECRET |
auto-generated | Signs login sessions. Generate with openssl rand -hex 32. |
ENCRYPTION_KEY |
auto-generated | Encrypts provider API keys at rest with AES-256-GCM. 64 hex characters. |
AUDIT_HMAC_SECRET |
auto-generated | Signs audit-trail entries with HMAC-SHA256. Pin it for multi-instance installs — see below. |
DB_PASSWORD is the one whose default deserves a second look. docker-compose.yml falls back to the literal pinchy_dev, which is fine for a laptop and unacceptable in production — so Pinchy does not leave it there. On the first production start the entrypoint generates a real password, applies it to PostgreSQL, and persists it in the pinchy-secrets volume. Set the variable yourself and your value wins, applied on the next restart even if the database still runs on an older one.
AUDIT_HMAC_SECRET is worth pinning in two situations: a fresh install where you want to hold the key yourself, and any deployment running more than one Pinchy instance against one database. In that second case it isn’t optional — each instance otherwise generates its own key, derives different pseudonyms for the same person, and none of them can show that user’s full history.
Once it’s set, Pinchy also writes the value into .audit_hmac_secret in the pinchy-secrets volume the first time it starts without a key file there, so a later change keeps the old key for verifying older entries. Setting or changing it on an install that has been running switches the signing key: follow Switching the key.
ENCRYPTION_KEY and AUDIT_HMAC_SECRET have to be exactly 64 hex characters, the output of openssl rand -hex 32. A value that isn’t is ignored, see When Pinchy ignores a key variable.
The one thing that cannot be recovered is a key you delete. Keep the pinchy-secrets volume in your backups even after pinning the value in .env. Backing up the keys has a command that saves the volume and .env together. Run it again after every key change, see Which backup to restore.
When Pinchy ignores a key variable
Section titled “When Pinchy ignores a key variable”A value that isn’t 64 hex characters, for example one with a 0x prefix, a character lost when copying, or a space inside it, is ignored. Quotes around the value and a Windows line ending aren’t a problem: Compose removes them before Pinchy sees the value. Pinchy uses the key file in the pinchy-secrets volume instead, creating one there if there is none, and logs a warning on every start: ENCRYPTION_KEY is set but is not a valid key or AUDIT_HMAC_SECRET is set but is not a valid key.
Don’t just correct the value. While the variable is ignored, the key file is the key in use, so a corrected value is a different key, and for ENCRYPTION_KEY that costs you every stored credential. Whatever you change, for either variable, back up the keys first, and back up again once the warning is gone.
ENCRYPTION_KEY. Everything Pinchy encrypted while the warning showed, provider API keys and integration credentials, is encrypted with .encryption_key in the pinchy-secrets volume (/app/secrets/.encryption_key inside the container). There are two safe fixes:
-
Remove the
ENCRYPTION_KEYline from.env. Pinchy carries on with the key file. The volume then holds the only copy of the key, so make sure it’s in your backups. -
Set the variable to the key file’s exact contents, so the key is in
.envtoo. Delete theENCRYPTION_KEY=line from.env, then run this in the directory that holds yourdocker-compose.yml:Terminal window printf '\nENCRYPTION_KEY=%s\n' "$(docker compose exec -T pinchy cat /app/secrets/.encryption_key)" >> .envThat copies the key straight into
.envwithout showing it on screen or in a log. The leading\nkeeps it off the end of the last line when.envdoesn’t end in a newline; a blank line in.envis harmless..envnow holds a key, so keep it readable by you alone (chmod 600 .env).
Either way, apply it with docker compose up -d. docker compose restart and docker compose start reuse the environment the container was created with and don’t read .env again; up -d recreates the container when .env changed. Afterwards the warning is gone from the start’s log (docker compose logs pinchy), and Settings → Integrations shows no “can’t be read” card.
Any other value, including a fresh one from openssl rand -hex 32, makes everything encrypted with the key file unreadable. Provider API keys and integration credentials then have to be re-entered, see When the ENCRYPTION_KEY changed. One case needs a closer look: if the variable held a working key before and only broke later, say a character lost when .env was edited, the credentials saved before that are encrypted with the original value, and only the ones saved since use the key file. Each key reads only its own share. Usually that makes the original value the right one: set the variable back to it exactly, from your .env backup if need be, apply it with docker compose up -d, and re-enter what was saved while it was broken. If that’s what you’d least like to re-enter, keep the key file with one of the two fixes above and re-enter the rest instead.
AUDIT_HMAC_SECRET. Until the value is valid, .audit_hmac_secret in the volume is the audit signing key, so don’t remove it. Removing the line from .env changes nothing: Pinchy keeps signing with the key file. Setting a new valid value switches the signing key, so follow Switching the key. Several instances against one database have to stop together first, see Switching the key on several instances.
Here too, one case needs a closer look: the variable held a working key and only broke later. Set it back to the exact original value, not a new one, from your .env backup if need be, and apply it with docker compose up -d.
If the key file holds that same value, that’s all: Pinchy signed with the same key throughout. It does unless you switched keys earlier and haven’t retired the earlier key yet, in which case Pinchy logged AUDIT_HMAC_SECRET is set and differs from the audit signing key on every start before the variable broke. Then breaking it switched Pinchy back to the key file, just like switching back to the earlier key: while it’s broken, the entries signed with the original value verify under no key, and new entries are signed with the key file. Setting it back brings back everything signed with the original value. A new value would leave all of it unverifiable.
In that case, the entries written while the variable was broken can’t be saved. They’re signed with the key file after entries signed with the original value, which is what a forgery looks like, so a full verification reports them in invalidIds on every run, and the background check may record a failure that can’t be cleared. Write down when the variable broke and when you fixed it, wherever you keep records for auditors, as described in Retiring the earlier key. Every flagged entry should fall between those two points.
Licence
Section titled “Licence”| Variable | Default | What it does |
|---|---|---|
PINCHY_ENTERPRISE_KEY |
none | Activates Enterprise features: groups, agent access control, and the usage dashboard’s per-user breakdown and CSV export. |
You can enter the same key in Settings → License instead — the environment variable exists so an unattended deployment doesn’t need a human in the UI. See Enterprise Setup.
Behaviour switches
Section titled “Behaviour switches”All of these are unset by default, and Pinchy behaves as described on the linked page. An empty value counts as unset. The defaults below are Pinchy’s own; Compose passes an empty value.
| Variable | Default | What it does |
|---|---|---|
PINCHY_KB_OCR |
on | off stops the knowledge base from sending scanned pages to your vision model. See What indexing sends to your provider. |
PINCHY_PROVIDER_BLOCK_PRIVATE_NETWORKS |
off | 1 also refuses provider base URLs on private networks. For managed hosts. See Which base URLs are allowed. |
ALLOW_PRIVATE_URLS |
off | 1 lets Odoo connections reach private networks. See Odoo on your own network. |
ALLOW_PRIVATE_MAIL_HOSTS |
off | 1 lets mail connections reach private networks. See Mail servers on your own network. |
PINCHY_USAGE_POLL_INTERVAL_MS |
60000 | How often the usage dashboard’s background sweep runs, in milliseconds (at least 1000). See Where the numbers come from. |
AUDIT_VERIFY_INTERVAL_MS |
6 hours | How often the audit trail verifies itself, in milliseconds. See Automatic verification. |
TELEGRAM_CONFLICT_AUTO_RESTART |
on | false stops the watchdog from restarting a Telegram bot stuck in a polling conflict; a newly connected bot is then disabled at the first sustained conflict instead of after the restarts. See Connect Additional Agents. |
TELEGRAM_CONFLICT_AUTO_DISABLE |
on | false stops the watchdog from disabling a newly connected bot that keeps losing a polling conflict. See Connect Additional Agents. |
TELEGRAM_CONFLICT_RECENT_WINDOW_MS |
24 hours | How long a bot counts as newly connected for the auto-disable above, in milliseconds. |
A change takes effect when the container is recreated. docker compose up -d does that, and docker compose restart does not, because it keeps the environment the container started with.
Resource limits
Section titled “Resource limits”Every container carries a memory and CPU cap so one runaway agent cannot take the host down with it. The defaults suit a 4 GB VPS.
| Variable | Default | What it does |
|---|---|---|
PINCHY_MEM_LIMIT |
1g |
Memory for the pinchy container (web UI, API, WebSocket bridge) |
PINCHY_CPUS |
1.5 |
CPU cores for pinchy |
OPENCLAW_MEM_LIMIT |
2g |
Memory for the openclaw container (agent runtime, model calls) |
OPENCLAW_CPUS |
2 |
CPU cores for openclaw |
DB_MEM_LIMIT |
1g |
Memory for the db container (PostgreSQL 17 + pgvector) |
DB_CPUS |
1 |
CPU cores for db |
PINCHY_CPUS also decides how many threads the knowledge base’s embedding model gets; CPU when the knowledge base embeds explains how, and how to set KB_EMBEDDING_THREADS through an override file when your host hides its CPU limit from the container.
Lowering OPENCLAW_MEM_LIMIT too far gets the gateway OOM-killed mid-conversation, which looks like a dropped chat rather than an out-of-memory error. Customizing Your Deployment has sizing tables, including what the knowledge base needs while it indexes Office documents.
Anything else
Section titled “Anything else”The list above is everything docker-compose.yml reads. Variables the containers use internally — DATABASE_URL, OPENCLAW_WS_URL — are assembled by Compose and are not meant to be set in .env; to change one anyway, use an override file rather than editing the Compose file you downloaded, so an upgrade doesn’t discard your change:
services: pinchy: environment: - SOME_VARIABLE=valueCompose merges docker-compose.override.yml automatically. Customizing Your Deployment covers the recipes we support and the ones we don’t.
Where the data lives
Section titled “Where the data lives”Variables configure the stack; volumes hold its state. These survive docker compose down and are what a backup must cover.
| Volume | Purpose |
|---|---|
pgdata |
PostgreSQL data — users, agents, conversations, the audit log |
pinchy-secrets |
Auto-generated secrets. Back this up, or you lose access to encrypted provider keys. |
openclaw-config |
Shared OpenClaw configuration |
pinchy-workspaces |
Agent workspaces (SOUL.md, AGENTS.md, uploads, workbench) |
pinchy-data |
The knowledge-base corpus, mounted read-only into the web tier |
openclaw-extensions |
Pinchy’s plugins for OpenClaw |
pinchy-pdf-cache |
Cached PDF text extractions — safe to delete, re-derived on demand |
pinchy-kb-artifacts |
Converted Office-document PDFs — safe to delete, re-derived on demand |
openclaw-secrets |
tmpfs, runtime only. Cleared on restart and rebuilt from the database. |
Installation shows the exact mount paths per container.