diff options
Diffstat (limited to 'cmd/mobius-hotline-server/main.go')
| -rw-r--r-- | cmd/mobius-hotline-server/main.go | 15 |
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) |