lora_server/config/
help.rs1use super::{
4 DEFAULT_HOST, DEFAULT_PORT, HOST_ENV, PORT_ENV, SNAPSHOT_PATH_ENV, WAL_DIR_ENV,
5 WAL_SYNC_MODE_ENV,
6};
7
8pub fn help_text() -> String {
9 let version = env!("CARGO_PKG_VERSION");
10 format!(
11 "lora-server {version} — HTTP server for the Lora in-memory graph database
12
13USAGE:
14 lora-server [OPTIONS]
15
16OPTIONS:
17 --host <HOST> Bind address. Default: {DEFAULT_HOST} (or ${HOST_ENV} if set).
18 --port <PORT> TCP port. Default: {DEFAULT_PORT} (or ${PORT_ENV} if set).
19 --snapshot-path <PATH> Enable the snapshot admin surface. Mounts
20 POST /admin/snapshot/save and
21 POST /admin/snapshot/load against this file.
22 Also acts as the default target for
23 POST /admin/checkpoint when --wal-dir is set.
24 Also read from ${SNAPSHOT_PATH_ENV}.
25 --restore-from <PATH> Restore the graph from this snapshot at boot.
26 Missing file is treated as empty. When
27 --wal-dir is also set, the WAL is replayed
28 on top of the snapshot.
29 --wal-dir <DIR> Attach a write-ahead log at this directory.
30 Every mutating query is bracketed by
31 begin/commit; a crashed process recovers
32 committed writes on next boot. Read-only
33 queries do not touch the WAL.
34 Also enables the WAL admin routes
35 (POST /admin/wal/status,
36 POST /admin/wal/truncate,
37 POST /admin/checkpoint) — independent of
38 --snapshot-path. /admin/checkpoint requires
39 `path` in the request body when no
40 --snapshot-path default is configured.
41 Also read from ${WAL_DIR_ENV}.
42 --wal-sync-mode <MODE> WAL durability cadence. One of:
43 per-commit fsync before each commit returns (default).
44 group buffer commits, fsync periodically.
45 none no fsync; rely on OS / external durability.
46 Also read from ${WAL_SYNC_MODE_ENV}.
47 --help Print this help and exit.
48 --version Print version and exit.
49
50ENVIRONMENT:
51 {HOST_ENV} Bind address (overridden by --host).
52 {PORT_ENV} TCP port (overridden by --port).
53 {SNAPSHOT_PATH_ENV} Path used by --snapshot-path.
54 {WAL_DIR_ENV} Directory used by --wal-dir.
55 {WAL_SYNC_MODE_ENV} Mode used by --wal-sync-mode.
56
57EXAMPLES:
58 lora-server
59 lora-server --host 0.0.0.0 --port 8080
60 lora-server --snapshot-path /var/lib/lora/graph.bin
61 lora-server --wal-dir /var/lib/lora/wal --snapshot-path /var/lib/lora/graph.bin \\
62 --restore-from /var/lib/lora/graph.bin
63"
64 )
65}
66
67pub fn version_text() -> String {
68 format!("lora-server {}", env!("CARGO_PKG_VERSION"))
69}