Server Configuration
Configure Torque with CLI arguments, environment variables, or a TOML config file. Settings resolve in order: CLI args > environment variables > TOML file > defaults.
CLI Arguments
| Argument | Default | Description |
|---|---|---|
--api-key | auto | Bootstrap API key (auto-generated with tq_ prefix if omitted) |
--api-addr | 0.0.0.0:8108 | HTTP API listen address |
--ingest-addr | 0.0.0.0:8109 | TCP ingest listen address |
--data-dir | ./data | Directory for persisted data (collections, indexes, keys) |
--log-level | info | Log level: trace, debug, info, warn, error |
--cors-origins | * | CORS allowed origins (comma-separated) |
--config | — | Path to TOML config file |
--license-key | — | Truespar license key |
--api-base | https://api.truespar.com | Truespar API base URL for license check-in |
--studio-dir | — | Path to pre-built Studio dist directory (overrides embedded files) |
--log-dir | — | Directory for daily rolling log files (e.g., torque.log.2026-03-13). When set, logs to both stdout and file. |
--slow-query-ms | 0 | Slow query logging threshold in milliseconds. Queries exceeding this are logged at WARN. 0 = disabled. |
--tls-cert | — | TLS certificate file path (PEM format). Requires --features tls at build time. |
--tls-key | — | TLS private key file path (PEM format). Requires --features tls at build time. |
--allow-drop-collection | true | Allow deleting collections via API. Disable with TORQUE_ALLOW_DROP_COLLECTION=false. |
--no-studio | — | Disable the embedded Studio web UI. Re-enable with TORQUE_STUDIO_ENABLED=true. |
--allowed-ips | — | HTTP API IP allowlist (comma-separated). Empty = allow all. |
Memory Configuration
| Argument | Default | Description |
|---|---|---|
--max-memory-percent | 90 | Maximum memory usage as percentage of system RAM |
--max-memory-bytes | — | Maximum memory in bytes (overrides percent) |
--max-http-body-bytes | unlimited | Maximum HTTP request body size in bytes (unlimited for TQBF uploads) |
--max-vector-memory-gb | 16 | Maximum vector index memory in GB |
--max-ingest-connections | 64 | Maximum concurrent TCP ingest connections |
--query-timeout-ms | 10000 | Query timeout in milliseconds |
GPU Configuration
| Argument | Default | Description |
|---|---|---|
--gpu-vram-budget-mb | 0 (auto) | GPU VRAM budget for dense bitmaps in MB. 0 auto-detects 50% of device VRAM. |
GPU acceleration is enabled automatically when a CUDA-capable NVIDIA GPU is detected. If no GPU is available, Torque falls back to CPU with no configuration change required.
Compaction
| Argument | Default | Description |
|---|---|---|
--compaction-interval-secs | 1800 (30 min) | Automatic compaction interval. 0 to disable. |
--compaction-memory-threshold-percent | 80 | Trigger compaction when memory usage exceeds this percent of max. 0 to disable. |
--overlay-flush-interval-ms | 1000 | Overlay persistence flush interval in milliseconds (realtime mode). |
Environment Variables
Every configuration option has a corresponding environment variable with the TORQUE_ prefix:
| Environment Variable | Equivalent CLI Argument |
|---|---|
TORQUE_API_KEY | --api-key |
TORQUE_API_ADDR | --api-addr |
TORQUE_INGEST_ADDR | --ingest-addr |
TORQUE_DATA_DIR | --data-dir |
TORQUE_LOG_LEVEL | --log-level |
TORQUE_CORS_ORIGINS | --cors-origins |
TORQUE_INGEST_ALLOW | TOML only: ingest_allow |
TORQUE_GPU_VRAM_BUDGET_MB | --gpu-vram-budget-mb |
TORQUE_MAX_VECTOR_MEMORY_GB | --max-vector-memory-gb |
TORQUE_MAX_HTTP_BODY_BYTES | --max-http-body-bytes |
TORQUE_MAX_MEMORY_PERCENT | --max-memory-percent |
TORQUE_MAX_MEMORY_BYTES | --max-memory-bytes |
TORQUE_MAX_INGEST_CONNECTIONS | --max-ingest-connections |
TORQUE_QUERY_TIMEOUT_MS | --query-timeout-ms |
TORQUE_LICENSE_KEY | --license-key |
TORQUE_API_BASE | --api-base |
TORQUE_STUDIO_DIR | --studio-dir |
TORQUE_OVERLAY_FLUSH_INTERVAL_MS | --overlay-flush-interval-ms |
TORQUE_COMPACTION_INTERVAL_SECS | --compaction-interval-secs |
TORQUE_COMPACTION_MEMORY_THRESHOLD_PERCENT | --compaction-memory-threshold-percent |
TORQUE_LOG_DIR | --log-dir |
TORQUE_SLOW_QUERY_MS | --slow-query-ms |
TORQUE_TLS_CERT | --tls-cert |
TORQUE_TLS_KEY | --tls-key |
TORQUE_ALLOW_DROP_COLLECTION | --allow-drop-collection |
TORQUE_STUDIO_ENABLED | --no-studio (inverse) |
TORQUE_ALLOWED_IPS | --allowed-ips |
TOML Configuration File
Create a torque.toml file in the working directory (auto-detected) or specify the path with --config:
# torque.toml
api_key = "your-api-key"
api_addr = "0.0.0.0:8108"
ingest_addr = "0.0.0.0:8109"
data_dir = "./data"
log_level = "info"
# CORS
cors_origins = ["https://app.example.com", "http://localhost:3000"]
# TCP ingest allowlist (empty = allow all)
ingest_allow = ["10.0.0.0/8", "192.168.1.0/24"]
# Memory
max_memory_percent = 90
# max_http_body_bytes = 134217728 # default: unlimited
max_vector_memory_gb = 16
max_ingest_connections = 64
query_timeout_ms = 10000
# GPU
gpu_vram_budget_mb = 0
# Compaction
compaction_interval_secs = 1800
compaction_memory_threshold_percent = 80
overlay_flush_interval_ms = 1000
# License
license_key = "tskey_..."
api_base = "https://api.truespar.com"
# TLS (requires --features tls build)
# tls_cert = "/etc/torque/cert.pem"
# tls_key = "/etc/torque/key.pem"
# Logging
# log_dir = "/var/log/torque"
# slow_query_ms = 100
TLS / HTTPS
Torque supports TLS encryption for the HTTP API:
# Start with TLS
torque-server --api-key KEY --tls-cert /path/to/cert.pem --tls-key /path/to/key.pem
When TLS is enabled, Studio and all API endpoints are served over HTTPS. The TCP ingest port does not use TLS.
Windows Service
On Windows, Torque can be installed and run as a Windows Service:
# Install the service (uses current CLI arguments)
torque-server --service-install --api-key YOUR_API_KEY --data-dir C:\torque\data
# Uninstall the service
torque-server --service-uninstall
Once installed, the service can be managed through the Windows Services manager (services.msc) or the command line:
# Start the service
net start TorqueServer
# Stop the service
net stop TorqueServer
Ports
Torque uses two ports by default:
| Port | Protocol | Description |
|---|---|---|
8108 | HTTP | Search API, document CRUD, collection management, Studio |
8109 | TCP | Binary ingest protocol (batch and realtime document streaming) |
Persistence
Torque persists data to the data_dir directory automatically. On restart, collections, indexes, aliases, API keys, synonyms, presets, and stopwords are restored from disk. No re-ingestion is required.
Persistence is enabled by default. The data directory contains:
- Collection schemas and metadata
- Compressed binary index data (per collection)
- Alias mappings
- API keys, synonym sets, presets, and stopword sets
- Realtime overlay data (for collections in realtime ingest mode)
Configuration Priority
When the same setting is specified in multiple places, higher-priority sources override lower ones:
- CLI arguments (highest priority)
- Environment variables
- TOML config file
- Built-in defaults (lowest priority)