From 4bd4c14daff4cb8807a91305239cae1e8544f276 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Wed, 8 Jul 2026 15:01:05 -0700 Subject: Add Cloudflare R2 file library storage backend Implement R2FileStore, a FileStore backed by Cloudflare R2 via its S3-compatible API, selectable with --file-store r2 and configured through R2_* environment variables. The store follows the MemFileStore model: a flat keyspace where directories are derived from key prefixes, with zero-byte marker objects so empty folders persist, and errors.ErrUnsupported for symlink/alias operations. Because R2 has no append, in-progress .incomplete uploads are routed to a local staging directory (real O_APPEND and size-based resume) and promoted to a finished R2 object on the terminal upload-commit Rename; all other paths live in R2. A narrow s3API seam plus an s3Uploader interface make the backend unit-testable against an in-memory fake without a network. Adds a user setup guide at docs/r2-file-store.md. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 3165535..3a25a5b 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,16 @@ Usage of mobius-hotline-server: To run as a systemd service, refer to this sample unit file: [mobius-hotline-server.service](https://github.com/jhalter/mobius/blob/master/cmd/mobius-hotline-server/mobius-hotline-server.service) +## File Storage + +By default the file library is stored on the server's local disk. The `-file-store` flag selects an alternate backend: + +- `os` (default) — local filesystem +- `memory` — in-memory, non-persistent (for testing) +- `r2` — [Cloudflare R2](docs/r2-file-store.md) object storage + +See [docs/r2-file-store.md](docs/r2-file-store.md) for R2 setup instructions. + ## HTTP API The Mobius server includes an optional HTTP API for server administration and user management. -- cgit