Skip to content

Commit

Permalink
document Cloudflare R2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
malt3 committed Dec 28, 2024
1 parent 95e7165 commit 3c8c9b3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ sequenceDiagram
The following providers are supported as of today:

- [AWS S3](/docs/providers/s3.md)
- [Cloudflare R2](/docs/providers/r2.md)
- [Google Cloud Storage (GCS)](/docs/providers/gcs.md)
- [GitHub](/docs/providers/github.md)

Expand Down Expand Up @@ -79,6 +80,8 @@ common --credential_helper=storage.googleapis.com=%workspace%/tools/credential-h
# S3
common --credential_helper=s3.amazonaws.com=%workspace%/tools/credential-helper
common --credential_helper=*.s3.amazonaws.com=%workspace%/tools/credential-helper
# Cloudflare R2
common --credential_helper=*.r2.cloudflarestorage.com=%workspace%/tools/credential-helper
```

Simply remove a line if you do not want the credential helper to be used for that service.
Expand Down
21 changes: 21 additions & 0 deletions docs/providers/r2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Cloudflare R2

This document explains how to setup your system for authenticating to R2 using the credential helper.

## Authentication

R2 has an S3-compatible API that requires the creation of special tokens. These are different from normal user tokens and are only used for R2.ß

- Create an API token by [following the documentation][r2-auth-tokens]
- Set the `R2_ACCESS_KEY_ID` and `R2_SECRET_ACCESS_KEY` environment variables when running Bazel or other tools

## Configuration

Add to your `.bazelrc`:

```
common --credential_helper=*.r2.cloudflarestorage.com=%workspace%/tools/credential-helper
```

[wrangler-install]: https://developers.cloudflare.com/workers/wrangler/install-and-update/
[r2-auth-tokens]: https://developers.cloudflare.com/r2/api/s3/tokens/
2 changes: 1 addition & 1 deletion docs/providers/s3.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AWS Simple Storage Service (S3)

This document explains how to setup you system for authenticating to S3 using the credential helper.
This document explains how to setup your system for authenticating to S3 using the credential helper.

## IAM Setup

Expand Down
3 changes: 3 additions & 0 deletions testdata/r2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"uri": "https://47ffb5f0a156e14a0985028c836501e2.r2.cloudflarestorage.com/r2-private-example/hello_world"
}

0 comments on commit 3c8c9b3

Please sign in to comment.