seed default channel(s) on boot
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user