docs: update docs for multi-server support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-21 19:04:23 +01:00
parent 073659607e
commit 144193e3bb
5 changed files with 99 additions and 6 deletions

View File

@@ -23,7 +23,9 @@ derp --config /path/to/derp.toml --verbose
## Configuration
All settings in `config/derp.toml`:
All settings in `config/derp.toml`.
### Single-Server (Legacy)
```toml
[server]
@@ -67,6 +69,55 @@ port = 8080 # Bind port
secret = "" # HMAC-SHA256 shared secret (empty = no auth)
```
### Multi-Server
Connect to multiple IRC servers from a single config. Plugins are loaded
once and shared; state is isolated per server (`data/state-<name>.db`).
```toml
[bot]
prefix = "!" # Shared defaults for all servers
plugins_dir = "plugins"
admins = ["*!~root@*.ops.net"]
[servers.libera]
host = "irc.libera.chat"
port = 6697
tls = true
nick = "derp"
channels = ["#test", "#ops"]
[servers.oftc]
host = "irc.oftc.net"
port = 6697
tls = true
nick = "derpbot"
channels = ["#derp"]
admins = ["*!~admin@oftc.host"] # Override shared admins
[logging]
level = "info"
format = "json"
[webhook]
enabled = true
port = 8080
secret = "shared-secret"
```
Each `[servers.<name>]` block may contain both server-level keys (host,
port, tls, nick, etc.) and bot-level overrides (prefix, channels, admins,
operators, trusted, rate_limit, rate_burst, paste_threshold). Unset keys
inherit from the shared `[bot]` and `[server]` defaults.
The server name (e.g. `libera`, `oftc`) is used for:
- Log prefixes and `!version` output
- State DB path (`data/state-libera.db`)
- Plugin runtime state isolation
Existing single-server configs (`[server]` section) continue to work
unchanged. The server name is derived from the hostname automatically.
## Built-in Commands
| Command | Description |
@@ -358,8 +409,8 @@ keys = bot.state.keys("myplugin")
bot.state.clear("myplugin")
```
Data is stored in `data/state.db` (SQLite). Each plugin gets its own
namespace so keys never collide.
Data is stored in `data/state-<name>.db` (SQLite, one per server). Each
plugin gets its own namespace so keys never collide.
### Inspection Commands (admin)