Configuration Reference
Startup settings use environment variables; service settings and scrub rules also have API controls. Pass startup values through the target container's environment map in the Compose file you run. A .env file supplies Compose substitutions; it does not inject arbitrary variables into containers.
Proxy (ghost-proxy)
| Variable | Default | Description |
|---|---|---|
GOSTLY_LICENSE_KEYrequired | — | License key issued from the Gostly dashboard. Gates tier-specific features. |
GOSTLY_TELEMETRY | on | Set exactly off to disable the agent usage shipper, its eligible aggregate lookup and cloud install-outcome receipts. This does not disable license validation or local onboarding events. Pass it into the proxy container and recreate it to load a changed environment. |
GOSTLY_OUTBOUND_ALLOWED_ORIGINS | unset | Optional exact-origin list for selected upstream HTTP requests and WebSocket dials. Unset/blank preserves prior behavior; a malformed nonblank list refuses covered destinations. Set the same list on ghost-web and ghost-proxy. The Full Compose file passes it to both; Lite passes it to neither, see Capture and outbound controls below. |
BACKEND_URLrequired | — | Base URL of the service to proxy in LEARN mode (e.g. http://your-service:3000 or https://api.example.com). Any reachable HTTP endpoint — production access not required. |
MOCK_DIR | /data/mocks | Path to the mock library directory inside the container. Must match the volume mount. |
MODE_FILE_PATH | /data/mode.txt | Path to the mode file. The proxy reads this on startup and watches it for changes. |
TRAFFIC_LOG_DIR | /data/traffic | Directory where raw JSONL traffic files are written during LEARN mode. |
WEBHOOK_DIR | /data/webhooks | Directory where captured inbound webhooks (and WebSocket frames, when WebSocket capture is on) are appended, one JSONL file per service. Must be on the shared data volume and match ghost-web's WEBHOOK_DIR. |
API_URL | http://ghost-web:8000 | Internal URL of the ghost-web control plane. Used for mode changes and reload signals. |
INFERENCE_URL | http://ghost-inference:5000 | Internal URL of the inference server. Required for AI generation. |
AI_CONFIDENCE_THRESHOLD | 0.70 | Default confidence threshold for serving an eligible cached inference response. A lower score skips that candidate and continues to later response sources or the configured unmatched response; it does not directly return 503. A calibrated per-route threshold can override this default. |
PROXY_PORT | 8080 | Port the proxy listens on. |
ACCEPT_INVALID_CERTS | false | Skip TLS certificate verification. This covers upstream connections and also the agent's own connections to the Gostly API and inference services in your stack. License validation and the usage-telemetry upload always verify certificates, whatever this flag says. Emits a startup warning. Only for staging environments with self-signed certs. |
REDACT_HEADERS | Authorization,Cookie,X-Api-Key | Comma-separated list of additional headers to redact. Adds to the non-overridable floor — cannot replace it. Both supplied Compose files default it to these three names, which the floor already covers. |
RUST_LOG | info | Log level for the proxy. One of: error, warn, info, debug, trace. |
WEBHOOK_DIR | /data/webhooks | Shared webhook and WebSocket-frame capture directory. The customer Compose sets this on both ghost-proxy and ghost-web; keep their paths and volume mount aligned. |
ENABLE_TLS_INTERCEPTION | false | Inbound TLS listener: true/lax/1 enables log-and-continue mode; strict exits on listener failure. The Full Compose file passes it from .env; Lite does not. Neither file publishes 8443; see the TLS guide. |
ENABLE_WS_CAPTURE | false | Opt-in frame capture for routed WebSocket traffic, subject to the service traffic capture switch. Frame bodies are not scrubbed and frames are not replayed. Both supplied Compose files pass it to ghost-proxy: set ENABLE_WS_CAPTURE=true in .env, then run docker compose up -d. |
GOSTLY_CASCADE_SHADOW | true | Background comparison for eligible smart-swap matches with AI enabled. 0/false/off disables that comparison and its generation requests, without changing serving order or ordinary AI-cache miss generation. Both supplied Compose files pass it to ghost-proxy: set GOSTLY_CASCADE_SHADOW=0 in .env, then run docker compose up -d. |
For a Compose file you maintain yourself, add the same names to the ghost-proxy.environment map. For the TLS listener and optional WebSocket capture, follow the TLS guide.
Control plane (ghost-web)
ghost-web serves both the operator dashboard on port 3000 and the control plane API on port 8000 from the same container.
| Variable | Default | Description |
|---|---|---|
GOSTLY_LICENSE_KEYrequired | — | Must match the license key used by the proxy. |
GOSTLY_TELEMETRY | on | Set off to disable outgoing dashboard usage uploads. Local dashboard event counters remain enabled and persistent; connected feature and seat checks are separate. Pass it into ghost-web and recreate the container to load a changed environment. |
DATABASE_URLrequired | — | Request-path PostgreSQL connection as the non-owner gostly_app role, with RLS enforced. The installer builds it from GOSTLY_APP_DB_PASSWORD. |
SERVICE_DATABASE_URLrequired | — | Separate gostly_service connection for cross-tenant maintenance, with RLS bypass. The installer builds it from GOSTLY_SERVICE_DB_PASSWORD. |
MIGRATIONS_DATABASE_URL | — | Schema-owner connection for the one-shot ghost-migrate job only. Keep migration credentials out of the serving ghost-web environment. |
GOSTLY_TENANT_ID | workspace identity | Set by setup in .env; use the same workspace identity throughout the stack. |
GOSTLY_PLATFORM_URL | https://gostly.ai | Platform origin used by the API for license-related contacts and its dashboard usage uploads. This does not redirect the agent's separate license or usage connections, and is not an air-gap switch. |
GOSTLY_PLATFORM_PUBLIC_URL | https://gostly.ai | Browser-visible Gostly account and billing URL. Set this when GOSTLY_PLATFORM_URL uses an internal container hostname. |
AGENT_URL | http://ghost-proxy:8080 | Internal URL of the proxy. Used to send reload signals. |
INFERENCE_URL | http://ghost-inference:5000 | Internal URL of the inference server. |
API_BASE_URL | http://ghost-web:8000 | Self-referential URL used by the inference server to fetch training data. |
MOCK_DIR | /data/mocks | Shared mock library directory. Must match the proxy's MOCK_DIR. |
TRAFFIC_LOG_DIR | /data/traffic | Shared traffic JSONL directory. Must match the proxy's TRAFFIC_LOG_DIR. |
WEBHOOK_DIR | /data/webhooks | Shared webhook and WebSocket-frame capture directory. Must match the proxy's WEBHOOK_DIR and volume mount. |
GOSTLY_CAPTURE_MAX_AGE_DAYS | unset | Optional maximum age, in whole days from 1 to 3650, for inbound webhook/WebSocket capture logs and their API rows, plus request-event database rows. Read by ghost-web; both supplied Compose files pass it through, and the .env that setup writes for a new install sets 30. Unset/blank keeps webhooks and frames with no maximum age, while request-event rows still keep 30 days; invalid values prevent API startup. |
GOSTLY_OUTBOUND_ALLOWED_ORIGINS | unset | Optional exact-origin list for webhook/canary replay, OpenAPI URL import and model connections. Unset/blank preserves prior behavior; a malformed nonblank list refuses covered destinations. This supplements existing address and private-target checks. Set the same list on ghost-web and ghost-proxy: the Full Compose file passes it to both, Lite to neither. |
GOSTLY_AUDIT_RETENTION_DAYS | 365 | Retained deployment audit age in days; default 365, accepted integers 1–3650. Validated at API startup; invalid values prevent startup. Scheduled bounded cleanup is separate from capture-age cleanup and is not a deletion deadline; see Audit retention below. |
LICENSE_CACHE_TTL | 300 | Seconds to cache license validation results. |
LICENSE_STALE_TTL | 14400 | Seconds to serve stale cache if the license server is unreachable. |
LOG_LEVEL | info | Structured log level. One of: debug, info, warning, error. |
Capture and outbound controls
The Full Compose file passes both settings from .env to the containers that read them. The Lite file passes GOSTLY_CAPTURE_MAX_AGE_DAYS to ghost-web but does not pass GOSTLY_OUTBOUND_ALLOWED_ORIGINS to any container, so on Lite setting the list in .env alone is not enough. Set it there and merge this fragment into the existing environment maps, keeping all other entries:
services:
ghost-web:
environment:
GOSTLY_OUTBOUND_ALLOWED_ORIGINS: "${GOSTLY_OUTBOUND_ALLOWED_ORIGINS:-}"
ghost-proxy:
environment:
GOSTLY_OUTBOUND_ALLOWED_ORIGINS: "${GOSTLY_OUTBOUND_ALLOWED_ORIGINS:-}"Run docker compose up -d after changing either setting: it recreates ghost-web after an age change and both containers after an origins change. API destination checks read its current process environment, while proxy clients retain the list from construction. Empty substitutions keep the corresponding policy unset.
Scheduled capture cleanup
Cleanup covers per-service webhook/WebSocket capture JSONL, mirrored webhook_captures rows and PostgreSQL request-event wide_events rows. With the setting unset, only the wide_events rows are aged out, after 30 days. The agent’s wide_events.jsonl needs no age rule: the capture sync moves it aside and deletes it on every pass. The API schedules batched passes, normally waiting an hour after each pass; exceptions can back off to six hours. This is not a maximum residence-time guarantee.
Eligible database rows can remain for later batches. File pruning removes an old leading prefix and stops at the first record not past the cutoff; older out-of-order lines can remain. Missing or unreadable timestamps encountered in that prefix count as old. Sync skips source entries already past the configured cutoff.
The agent refuses cleanup cutoffs less than one day old according to its clock. A locked or unreachable agent can defer file cleanup while database cleanup proceeds. Rewrites hold the file writer: HTTP capture can wait or return 503 under queue pressure, and WebSocket capture records can be dropped while forwarding continues. These are capture-record losses, not transport-frame deletion.
Only passes with removals attempt an audit event with counts and outcome metadata, without bodies or URLs. Audit failure does not undo committed cleanup. Recordings/mocks and revisions, LEARN logs and seals, training corpora/adapters and backups are excluded; review the retained-data boundary.
Selected outbound destinations
Use comma-separated exact http://host[:port] or https://host[:port] origins. Default ports are 80/443; an optional trailing slash is accepted. Userinfo, wildcards, non-root paths, queries and fragments are not allowed. A malformed nonblank or comma-only list admits no covered destinations.
The list covers API webhook/canary replay, OpenAPI URL import and model connections, plus proxy upstream HTTP and WebSocket dials; ws/wss use http/https entries. Origin membership does not grant private-address permission. API replay still needs its private-origin approval or local replay exception; models retain separate private approval and remote consent, and URL import remains public HTTPS. Agent private/loopback handling uses GOSTLY_EGRESS_STRICT, not the API private-origin list.
Agent API, inference, licensing and telemetry contacts are outside this list. Raw CONNECT tunnels whose first bytes are neither TLS nor an HTTP GET can bypass it. Use deployment network egress policy when every outbound path must be restricted.
Audit retention and bounded cleanup
The API elects a leader for tenant-bound, bounded cleanup of retained audit rows, legacy authentication events and expired/revoked login sessions. It normally waits 600 seconds after a pass; exceptions back off up to 3600 seconds. Locked rows, backlog and downtime can delay removal. Expired retained rows can remain readable until physically removed. This policy is separate from capture-age cleanup.
The legacy auth-trail age cutoff is clamped to 30 days. Retained audit also honors each row’s stored expires_at, so ordinary rows created under a 1–29-day setting can be removed sooner; this is not a universal 30-day minimum. Scheduled pruning protects prune-audit records younger than 30 days. Some auth/session cleanup commits before its later summary audit write; an audit failure does not undo that cleanup.
The following example uses a matched Full Compose installation; in Lite, add --entrypoint /app/ghost-web-entrypoint.sh after --rm. Audit prune requires a schema-owner or superuser database connection, selected from MIGRATIONS_DATABASE_URL or otherwise DATABASE_URL. The runtime gostly_app and gostly_service roles are refused. An API admin account or service key does not grant database-owner rights.
docker compose run --rm ghost-migrate admin audit-prune --limit 1000 --older-than-days N --tenant-id TENANTReplace N with a day count from 1 to 3650 and TENANT with the intended deployment tenant. The command previews by default; append --apply to mutate and optionally --json for structured output. --limit is 1–10000 rows per table, default 1000, not a whole-command cap. Apply requires explicit --tenant-id unless the tenant came from environment/license; sole-user-table inference is insufficient.
--older-than-days is optional. Without it, the command still selects expired retained audit and dead login sessions, but does not prune legacy auth rows. With it, older retained/auth rows are also eligible. A bounded invocation need not remove every eligible row and does not erase backups. See the deployment audit API for read/export admission.
API secret-store key
The API creates its key file on the first secret save: at GOSTLY_SECRET_STORE_KEY_FILE when that is set, otherwise at ${DATA_DIR}/secret-store.key (DATA_DIR defaults to /data). The Lite Compose file uses /data/secret-store.key, on the gostly-data volume. The Full file sets /var/lib/gostly/secret-store/secret-store.key, on its own secret-store volume. This is a generated installation key file, not an environment-supplied replacement key or remote key service.
Keep it a regular, non-symlink file owned by the effective API user with permissions exactly 0600. The API refuses key files with invalid type, ownership, mode or contents. New key material cannot decrypt credentials protected by a missing key.
GOSTLY_MODEL_MASTER_KEY is retired and retained only for legacy credential upgrade/downgrade handling; it is not the current secret-store setup. Review the supported credential and shared-volume boundary and preserve matching material with the database backup.
Reseal stored credentials
Reseal re-encrypts eligible saved provider/model credentials for the selected tenant. The command runs in the running API container and reads the API’s actual key file, at the path named by GOSTLY_SECRET_STORE_KEY_FILE, or ${DATA_DIR}/secret-store.key (default /data/secret-store.key). Prepare a valid new first key line while retaining older lines. The command does not generate a key; changing the first line alone affects future saves, not existing ciphertext.
docker compose exec -w /app/api ghost-web python -m admin secrets resealThis previews by default; append --apply to reseal, optionally with --json. It uses the API’s own connection and tenant and takes no --tenant-id, --limit or --older-than-days flags. Inspect counts and key IDs before applying. Unreadable or retired values remain; new key material cannot recover them. Current-key-ID values are not decrypted again, so zero unreadable is not a credential/provider health check. An owner can also run it from Settings → Status: Check previews and Re-seal applies.
Protect matching key bytes separately from the database dump. Keep older key lines while stored credentials or retained dumps need them; reseal does not update old backups, and a key ID cannot decrypt a dump. Follow the secret-store backup instructions.
These two maintenance commands remain available after a license admitted by the no-Gostly-egress checks expires. Signature, profile and installation admission still apply; the commands do not reopen product traffic. A later admin.command audit failure can make a command report failure after its operation committed. Inspect the operation output and audit result before repeating it.
Inference server (ghost-inference, Full stack)
The inference server is included only in the Full stack. ENABLE_RAG is on by default, and the Full stack sets LLAMACPP_ENDPOINT, so generation runs through the ghost-llamacpp sidecar.
| Variable | Default | Description |
|---|---|---|
LLAMACPP_ENDPOINT | Full stack: http://ghost-llamacpp:8080 | Set by the Full stack. Routes generation through the sibling ghost-llamacpp sidecar, which serves the base model and any per-service LoRA adapters. It is the only generation backend: without it, the inference server reports generation as unavailable. |
ENABLE_GENERATION | (retired) | Retired. In-process PyTorch serving has been removed: a leftover true value is ignored with a startup warning and never loads a model for serving. You can delete it from older .env files. |
ENABLE_RAG | true | Enable embedding-based retrieval in the inference service, using the configured embedding model (default all-MiniLM-L6-v2). With eligible examples available, high similarity can reuse a recorded response. Retrieval thresholds are separate from the proxy's confidence gate and do not guarantee a served response. |
GEN_MODEL | /models/ghostmock-base-v2-200k | Base weights that local adapter training starts from. The inference image sets it to the base model it bundles, so you don't need to set it. |
MOCK_DIR | /data/mocks | Source directory for the mock library. Must match ghost-proxy and ghost-web. |
API_BASE_URL | http://ghost-web:8000 | Used by the inference server to fetch training data and register adapters. |
Header redaction
Imported mock rows receive structural credential redaction and sensitive response-header redaction before storage; review files for sensitive data outside those rules. The following headers are redacted by default before recorded traffic is written to disk. Configuration cannot remove or replace entries on this list; keeping original credential headers in local files requires explicitly opting out of redaction for local persistence; review the destination and access policy separately:
authorization proxy-authorization cookie set-cookie x-api-key x-auth-token x-session-id x-access-token x-user-token x-csrf-token x-amz-security-token x-amz-session-token x-goog-api-key grpc-metadata-authorization api-key token
Use REDACT_HEADERS to add your own on top of this floor:
REDACT_HEADERS=x-internal-token,x-customer-id,my-custom-auth
Scrub rules
Scrub rules are configured via the API and apply during the LEARN → MOCK transition. They operate on request and response bodies and query parameters:
# Set global scrub config
PUT /scrub/config
{
"global": {
"headers": ["x-custom-session"],
"query_params": ["trace_id", "debug_token"],
"body_paths": ["$.user.email", "$.payment.card_number"],
"body_patterns": ["\\b[A-Z0-9]{20,}\\b"] // custom regex for tokens
},
"services": {
"payments": {
"body_paths": ["$.card.cvv", "$.card.expiry"]
}
}
}JSONPath expressions ($.field.nested) are used for targeted field removal. Regex patterns are validated at save time — overly broad patterns that would match everything are rejected.
Feature flags by tier
| Feature | Pro | Team |
|---|---|---|
| Exact match | ✓ | ✓ |
| Chaos injection | ✓ | ✓ |
| Per-service mode | ✓ | ✓ |
| Smart swap¹ | ✓ | ✓ |
| AI inference fallback | ✓ | ✓ |
| Generative AI | ✓ | ✓ |
| MCP server | ✗ | ✓ |
| Team activity log | ✗ | ✓ |
| Max services | ∞ | ∞ |
¹ Smart swap is on for every license.
API endpoints
Full API reference moved to /docs/api. Covers authentication, idempotency, error envelopes, pagination, rate limits, and every endpoint grouped by feature surface.