upleb.uk

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

summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-03 11:17:39 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-03 11:19:20 +0000
commit57bc8cd9c021feaf08e139e8fb62800bc476068e (patch)
treec62abdffb4c91999cae2f570597b9ac154c2e51d /README.md
parent2f8ecd482077d82f2d1a937c7f979eaaa87a27b2 (diff)
improved settings cli flags > env vars > defaults
Diffstat (limited to 'README.md')
-rw-r--r--README.md74
1 files changed, 65 insertions, 9 deletions
diff --git a/README.md b/README.md
index d2b2629..7dede9b 100644
--- a/README.md
+++ b/README.md
@@ -100,15 +100,71 @@ nix develop -c cargo test --lib
100 100
101## Configuration 101## Configuration
102 102
103Environment variables (see `.env.example`): 103Configuration is loaded with the following priority (highest to lowest):
104 104
105- `NGIT_DOMAIN`: Your domain (e.g., `gitnostr.com`) 1051. **CLI flags** (e.g., `--domain example.com`)
106- `NGIT_OWNER_NPUB`: Relay owner's npub 1062. **Environment variables** (e.g., `NGIT_DOMAIN=example.com`)
107- `NGIT_RELAY_NAME`: Relay name for NIP-11 1073. **.env file** (loaded automatically if present)
108- `NGIT_RELAY_DESCRIPTION`: Relay description 1084. **Built-in defaults**
109- `NGIT_GIT_DATA_PATH`: Path to store Git repositories 109
110- `NGIT_RELAY_DATA_PATH`: Path to store Nostr events 110This means CLI flags always take precedence over environment variables, which take precedence over `.env` file values.
111- `NGIT_BIND_ADDRESS`: Server bind address (default: `127.0.0.1:8080`) 111
112### CLI Usage
113
114```bash
115# View all options with defaults
116ngit-grasp --help
117
118# Run with CLI flags (override everything else)
119ngit-grasp --domain relay.example.com --owner-npub npub1... --bind-address 0.0.0.0:8080
120
121# Mix CLI flags with environment variables
122NGIT_OWNER_NPUB=npub1... ngit-grasp --domain relay.example.com
123```
124
125### Configuration Options
126
127| Option | CLI Flag | Environment Variable | Default |
128| ----------------- | --------------------- | ------------------------ | -------------------------------------------- |
129| Domain | `--domain` | `NGIT_DOMAIN` | (required) |
130| Owner npub | `--owner-npub` | `NGIT_OWNER_NPUB` | (optional) |
131| Relay name | `--relay-name` | `NGIT_RELAY_NAME` | `${domain} grasp relay` |
132| Relay description | `--relay-description` | `NGIT_RELAY_DESCRIPTION` | `Git Nostr Relay - a grasp implementation` |
133| Git data path | `--git-data-path` | `NGIT_GIT_DATA_PATH` | `./data/git` (temp dir for memory backend) |
134| Relay data path | `--relay-data-path` | `NGIT_RELAY_DATA_PATH` | `./data/relay` (temp dir for memory backend) |
135| Bind address | `--bind-address` | `NGIT_BIND_ADDRESS` | `127.0.0.1:8080` |
136| Database backend | `--database-backend` | `NGIT_DATABASE_BACKEND` | `lmdb` |
137
138### Database Backends
139
140- `lmdb`: LMDB backend (default, persistent, general purpose)
141- `memory`: In-memory database (fastest, no persistence - uses temp directories)
142- `nostrdb`: NostrDB backend (persistent, optimized for Nostr) [Not yet implemented]
143
144> **Note:** When using the `memory` backend, git data are automatically stored in temporary directories for ephemeral testing. This is useful for development and CI/CD pipelines.
145
146### Example: Production Deployment
147
148```bash
149# Using environment variables (recommended for production)
150export NGIT_DOMAIN=gitnostr.com
151export NGIT_OWNER_NPUB=npub1...
152export NGIT_BIND_ADDRESS=0.0.0.0:8080
153export NGIT_DATABASE_BACKEND=lmdb
154ngit-grasp
155```
156
157### Example: Development
158
159```bash
160# Using .env file
161cp .env.example .env
162# Edit .env with your settings
163ngit-grasp
164
165# Or override specific values with CLI flags
166ngit-grasp --domain localhost:3000 --bind-address 127.0.0.1:3000
167```
112 168
113## Documentation 169## Documentation
114 170