upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-21 04:04:05 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-21 04:04:05 +0000
commit2e799fa7ec57d284c643df8b8dc54471470f5c59 (patch)
tree0d8affa3e742d34e8d5a251b4ae50678c10a10d5 /docs
parent25b206c00766579f2322619f4716ca999f9b92ec (diff)
feat: add database backend configuration options
Add environment variable configuration for database backend selection: - Added DatabaseBackend enum (memory, nostrdb, lmdb) in src/config.rs - Updated relay builder to use configured backend in src/nostr/builder.rs - Added NGIT_DATABASE_BACKEND to .env.example with documentation - Updated docs/reference/configuration.md with backend comparison table NostrDB and LMDB backends prepared for future implementation when nostr-relay-builder adds support. Currently defaults to in-memory database with warning logs when persistent backends are selected.
Diffstat (limited to 'docs')
-rw-r--r--docs/reference/configuration.md41
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md
index fc7bbe0..e2ec9aa 100644
--- a/docs/reference/configuration.md
+++ b/docs/reference/configuration.md
@@ -224,6 +224,47 @@ NGIT_RELAY_DATA_PATH=/mnt/ssd/relay-data
224 224
225--- 225---
226 226
227#### `NGIT_DATABASE_BACKEND`
228
229**Description:** Database backend type for storing Nostr events
230**Type:** String (enum: memory, nostrdb, lmdb)
231**Default:** `memory`
232**Required:** No
233
234**Valid Values:**
235- `memory` - In-memory database (default, fastest, no persistence)
236- `nostrdb` - NostrDB backend (persistent, optimized for Nostr) [Not yet implemented]
237- `lmdb` - LMDB backend (persistent, general purpose) [Not yet implemented]
238
239**Examples:**
240```bash
241# Development (default, no persistence)
242NGIT_DATABASE_BACKEND=memory
243
244# Production with NostrDB (when implemented)
245NGIT_DATABASE_BACKEND=nostrdb
246
247# Production with LMDB (when implemented)
248NGIT_DATABASE_BACKEND=lmdb
249```
250
251**Comparison:**
252
253| Backend | Persistence | Performance | Use Case |
254|---------|-------------|-------------|----------|
255| memory | No | Fastest | Development, testing |
256| nostrdb | Yes | High | Production (Nostr-optimized) |
257| lmdb | Yes | High | Production (general purpose) |
258
259**Notes:**
260- `memory` backend loses all data on restart
261- NostrDB and LMDB backends will use `NGIT_RELAY_DATA_PATH` for storage
262- NostrDB and LMDB are planned features, not yet available
263- Default `memory` backend suitable for development and testing only
264- Production deployments should use persistent backends when available
265
266---
267
227### Logging Configuration 268### Logging Configuration
228 269
229#### `RUST_LOG` 270#### `RUST_LOG`