From 52eb3389f074e8ac28fa1eae90847fb7536acdd8 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:11:20 -0700 Subject: Add --file-store flag to select the file library backend Wire an os|memory selector mirroring the existing Redis-vs-file backend selection. This marks the seam where a future object-store backend (e.g. Cloudflare R2 / S3) slots in via hotline.WithFileStore. --- cmd/mobius-hotline-server/main.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'cmd') diff --git a/cmd/mobius-hotline-server/main.go b/cmd/mobius-hotline-server/main.go index 5191805..35fbcf9 100644 --- a/cmd/mobius-hotline-server/main.go +++ b/cmd/mobius-hotline-server/main.go @@ -49,6 +49,7 @@ func main() { tlsCert := flag.String("tls-cert", "", "Path to TLS certificate file") tlsKey := flag.String("tls-key", "", "Path to TLS key file") tlsPort := flag.Int("tls-port", 5600, "Base TLS port. TLS file transfer port is base + 1.") + fileStoreBackend := flag.String("file-store", "os", "File library storage backend: os (default) or memory") flag.Parse() @@ -103,6 +104,20 @@ func main() { opts = append(opts, hotline.WithTLS(tlsConfig, *tlsPort)) } + // Select the file library storage backend. This is the seam a future object-store backend + // (e.g. Cloudflare R2 / S3) slots into, mirroring the Redis-vs-file selection below: build + // the concrete FileStore and pass it via hotline.WithFileStore. + switch *fileStoreBackend { + case "os", "": + // Default OSFileStore is set by NewServer; nothing to do. + case "memory": + opts = append(opts, hotline.WithFileStore(hotline.NewMemFileStore())) + slogger.Warn("Using in-memory file store; uploaded files are not persisted") + default: + slogger.Error("Unknown file-store backend", "backend", *fileStoreBackend) + os.Exit(1) + } + srv, err := hotline.NewServer(opts...) if err != nil { slogger.Error("Error starting server", "err", err) -- cgit