seed default channel(s) on boot
ci / build (pull_request) Successful in 23s
ci / image (pull_request) Skipped

fresh relay seeds configured open channels (RELAY_DEFAULT_CHANNELS,
default general) so a client always has a room. relay-signed 9007
through the normal pipeline; idempotent; never reopens a closed group.

also adds mission/roadmap and separation rationale to the readme.
This commit is contained in:
Robert Goodall
2026-07-25 08:11:39 -04:00
parent 294616642f
commit 8e9235a820
7 changed files with 220 additions and 15 deletions
+9 -2
View File
@@ -10,6 +10,7 @@
package main
import (
"context"
"log"
"net/http"
"os"
@@ -63,8 +64,10 @@ func main() {
contact: envOr("RELAY_CONTACT", "relay@nosterm.com"),
// Optional message-of-the-day shown in the client's relay server window;
// defaults to the nerdworks.io banner when unset.
motd: envOr("RELAY_MOTD", defaultMOTD),
fedCfg: fedCfg,
motd: envOr("RELAY_MOTD", defaultMOTD),
// Seed at least one open channel so a fresh relay is never empty.
defaultChannels: parseChannels(envOr("RELAY_DEFAULT_CHANNELS", "general")),
fedCfg: fedCfg,
})
// Reconstruct membership/metadata from persisted events so groups survive
@@ -73,6 +76,10 @@ func main() {
log.Printf("replayed %d group management event(s) from storage", replayed)
}
// Seed default channel(s) after replay so a fresh relay always has a room to
// join; existing channels are left untouched.
app.SeedDefaultChannels(context.Background())
// Retention: prune old chat messages so the store doesn't grow forever.
stopRetention := retention.Start(store, retention.Config{
MaxAge: time.Duration(envIntOr("RELAY_RETENTION_DAYS", 0)) * 24 * time.Hour,