aboutsummaryrefslogtreecommitdiff
path: root/cmd/mobius-hotline-server/main.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2026-07-08 09:11:20 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2026-07-08 09:11:20 -0700
commit52eb3389f074e8ac28fa1eae90847fb7536acdd8 (patch)
tree25944bd23cb7ab3712e3fd65ad93c5f14cc1477c /cmd/mobius-hotline-server/main.go
parent3e5ae31fa6d8c33f61d070ca20c34c0dcba7666b (diff)
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.
Diffstat (limited to 'cmd/mobius-hotline-server/main.go')
-rw-r--r--cmd/mobius-hotline-server/main.go15
1 files changed, 15 insertions, 0 deletions
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)