diff --git a/README.md b/README.md index d47de8919..b2c25786e 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Table of Contents (ToC) * Storage Options * [Local](docs/Local.md) * [S3](docs/S3.md) + * [R2](docs/S3.md#R2) * [Redis](docs/Redis.md) * [Memcached](docs/Memcached.md) * [Google Cloud Storage](docs/Gcs.md) diff --git a/docs/Configuration.md b/docs/Configuration.md index d7e62a289..8be9f4289 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -86,6 +86,12 @@ configuration variables The endpoint used then becomes `${SCCACHE_BUCKET}.s3-{SCCACHE_REGION}.amazonaws.com`. If `SCCACHE_REGION` is undefined, it will default to `us-east-1`. +#### cloudflare r2 + +* `SCCACHE_BUCKET` is the name of your R2 bucket. +* `SCCACHE_ENDPOINT` must follow the format of `https://.r2.cloudflarestorage.com`. Note that the `https://` must be included. Your account ID can be found [here](https://developers.cloudflare.com/fundamentals/get-started/basic-tasks/find-account-and-zone-ids/). +* `SCCACHE_REGION` should be set to `auto`. + #### redis * `SCCACHE_REDIS` full redis url, including auth and access token/passwd diff --git a/docs/S3.md b/docs/S3.md index cb6898d7e..98c0dbf1f 100644 --- a/docs/S3.md +++ b/docs/S3.md @@ -8,6 +8,14 @@ If your endpoint requires HTTPS/TLS, set `SCCACHE_S3_USE_SSL=true`. If you don't You can also define a prefix that will be prepended to the keys of all cache objects created and read within the S3 bucket, effectively creating a scope. To do that use the `SCCACHE_S3_KEY_PREFIX` environment variable. This can be useful when sharing a bucket with another application. +# R2 + +Cloudflare R2 is an S3-compatible object storage and works with the same configuration options as above. To use R2, you **must** define `SCCACHE_ENDPOINT`, otherwise sccache will default to AWS as the endpoint to hit. R2 also requires endpoint connections to be secure, therefore `https://` either needs to be included in `SCCACHE_ENDPOINT` or `SCCACHE_S3_USE_SSL=true` can be used, if the protocol is omitted. There are no regions in R2, so `SCCACHE_REGION` must point to `auto`. The below environment variables are recommended. + +* `SCCACHE_BUCKET` is the name of your R2 bucket. +* `SCCACHE_ENDPOINT` should follow the format of `https://.r2.cloudflarestorage.com`. It is recommended that `https://` be included in this env var. Your account ID can be found [here](https://developers.cloudflare.com/fundamentals/get-started/basic-tasks/find-account-and-zone-ids/). +* `SCCACHE_REGION` should be set to `auto`. + ## Credentials Sccache is able to load credentials from various sources. Including: