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

Configuration

The laurus-server can be configured through CLI arguments, environment variables, and a TOML configuration file.

Configuration Priority

Server and index settings are resolved in the following order (highest priority first):

CLI arguments > Environment variables > Config file > Defaults

The index directory is not part of this order: as for every laurus command, only the global --index-dir option or the LAURUS_INDEX_DIR environment variable sets it (default ./laurus_index), and the config file has no key for it (Issue #1718).

Log verbosity is controlled exclusively by the RUST_LOG environment variable (default: info).

For example:

# CLI argument wins over environment variable and config file
LAURUS_PORT=4567 laurus serve --config config.toml --port 1234
# -> Listens on port 1234

# Environment variable wins over config file
LAURUS_PORT=4567 laurus serve --config config.toml
# -> Listens on port 4567

# Config file value is used when no CLI argument or env var is set
laurus serve --config config.toml
# -> Uses port from config.toml (or default 50051 if not set)

TOML Configuration File

Format

[server]
host = "0.0.0.0"
port = 50051
http_port = 8080  # Optional: enables HTTP Gateway
max_result_window = 10000  # Optional; largest offset + limit per search

[index.wal]
sync_policy = "group"          # "per_record" (default) | "group"
group_max_records = 1024       # optional; default 1024
group_max_bytes = 1048576      # optional; default 1 MiB
group_max_interval_ms = 1000   # optional; no timer when unset, 0 syncs every append (native only)

[index.commit]
policy = "every_docs"          # "manual" (default) | "every_docs" | "interval"
every_docs = 1000              # optional; commit every N docs (0/unset disables)
interval_ms = 1000             # "interval" only; commit at least every N ms (0/unset disables, native only)

Log verbosity is controlled by the RUST_LOG environment variable (default: info), not through the config file.

Unknown Keys

Every table accepts only the keys the Field Reference lists for it, and the file has no other tables. Any other key, such as a misspelled prot under [server] or a port written outside [server], is not left at its default: the server does not start, and the error names the file and the key (Issue #1708). For example, with prot = 50051 under [server]:

$ laurus serve --config config.toml
Error: Failed to parse config file: config.toml

Caused by:
    TOML parse error at line 3, column 1
      |
    3 | prot = 50051
      | ^^^^
    unknown field `prot`, expected one of `host`, `port`, `http_port`, `max_result_window`

Field Reference

[server] Section

FieldTypeDefaultDescription
hostString"0.0.0.0"Listen address for the gRPC server
portInteger50051Listen port for the gRPC server
http_portInteger–HTTP Gateway port. When set, the HTTP/JSON gateway starts alongside gRPC.
max_result_windowInteger10000Largest offset + limit a search may request (the default limit of 10 counts when limit is unset). Larger searches (gRPC, HTTP and MCP) are rejected with INVALID_ARGUMENT / HTTP 400. Must be at least 1. Like Elasticsearch’s index.max_result_window (Issue #1367).

[index] Section

The [index] table only holds the [index.wal] and [index.commit] tables below. It does not set the index directory, which comes from --index-dir or LAURUS_INDEX_DIR (see CLI Arguments): a data_dir key is an error, and the server does not start (Issue #1718). Before, the key was accepted and ignored, and the server used ./laurus_index, the default of --index-dir. For example, with data_dir = "/var/lib/laurus/data" under [index]:

$ laurus serve --config config.toml
Error: Failed to parse config file: config.toml

Caused by:
    TOML parse error at line 2, column 12
      |
    2 | data_dir = "/var/lib/laurus/data"
      |            ^^^^^^^^^^^^^^^^^^^^^^
    the index directory is not read from the config file: `laurus serve` takes it from `--index-dir` or `LAURUS_INDEX_DIR` (default `./laurus_index`)

[index.wal] Section

Controls the Write-Ahead Log (WAL) durability policy. When the whole section is omitted, the WAL uses per-record fsync (every write is durable before it returns). The policy applies to both an index opened at boot and any index created later through CreateIndex. See Persistence & WAL → WAL Durability Policy for the durability trade-off.

FieldTypeDefaultDescription
sync_policyString"per_record"Durability policy: "per_record" (fsync every write) or "group" (batch fsyncs)
group_max_recordsInteger1024Group commit only. Flush once this many records accumulate since the last sync
group_max_bytesInteger1048576Group commit only. Flush once this many bytes accumulate since the last sync (default 1 MiB)
group_max_interval_msInteger–Group commit only. Periodic background flush interval in milliseconds. No timer runs when unset. 0 runs no timer either, but syncs every append, like group_max_records = 0. Native targets only — a non-zero interval is ignored on wasm32

Under sync_policy = "group", the WAL flushes when either group_max_records records or group_max_bytes bytes have accumulated since the last sync (whichever comes first), and unconditionally on commit. A crash can lose up to the last unsynced batch (comparable to SQLite synchronous = NORMAL); a torn trailing record is dropped on recovery, so the recovered log is gap-free.

[index.commit] Section

Controls the auto-commit policy. When the whole section is omitted, the engine is manual — it commits only when the server materializes an index (there is no automatic commit during ingestion). The policy applies to both an index opened at boot and any index created later through CreateIndex. See Persistence & WAL → Auto-commit Policy for the semantics. "interval" is the time-based counterpart of "every_docs" and is native only — under WebAssembly it is a no-op because there are no background threads.

FieldTypeDefaultDescription
policyString"manual"Auto-commit policy: "manual" (caller-driven commits), "every_docs" (commit every every_docs applied documents), or "interval" (commit at least every interval_ms milliseconds)
every_docsInteger–every_docs policy only. Commit after this many applied documents. Unset (or 0) disables auto-commit, equivalent to "manual"
interval_msInteger–interval policy only. Auto-commit at least this often (milliseconds) via a background timer, so a trailing partial batch commits even while ingestion is idle — the time-based counterpart of every_docs. Unset (or 0) disables auto-commit, equivalent to "manual". Native targets only — treated as a no-op on wasm32 (no background threads)

CommitPolicy is orthogonal to [index.wal]: the WAL section governs when appends are fsync’d, while this section governs when the stores materialize. An auto-commit works under any WAL policy because a commit always begins with a WAL flush.

Environment Variables

VariableMaps ToDescription
LAURUS_HOSTserver.hostListen address
LAURUS_PORTserver.portgRPC listen port
LAURUS_HTTP_PORTserver.http_portHTTP Gateway port
LAURUS_MAX_RESULT_WINDOWserver.max_result_windowLargest offset + limit per search
LAURUS_INDEX_DIR--index-dir (global option)Index data directory
RUST_LOG–Log filter directive (e.g. info, debug, laurus=debug,tonic=warn)
LAURUS_CONFIG–Path to TOML config file

CLI Arguments

OptionShortDefaultDescription
--config <PATH>-c–Path to TOML configuration file
--host <HOST>-H0.0.0.0Listen address
--port <PORT>-p50051gRPC listen port
--http-port <PORT>––HTTP Gateway port
--max-result-window <N>–10000Largest offset + limit per search
--index-dir <PATH>–./laurus_indexIndex data directory (global option)

Common Configurations

Development (gRPC only)

[server]
host = "127.0.0.1"
port = 50051
RUST_LOG=debug laurus --index-dir ./dev_data serve --config config.toml

Production (gRPC + HTTP Gateway)

[server]
host = "0.0.0.0"
port = 50051
http_port = 8080
laurus --index-dir /var/lib/laurus/data serve --config config.toml

Minimal (environment variables only)

export LAURUS_INDEX_DIR=/var/lib/laurus/data
export LAURUS_PORT=50051
export LAURUS_HTTP_PORT=8080
export RUST_LOG=info
laurus serve