# `SiteMaps.Adapters.R2`
[🔗](https://github.com/marcosgz/site_maps_ex/blob/v0.1.0/lib/site_maps/adapters/r2.ex#L1)

Stores sitemaps in Cloudflare R2, through its S3-compatible API.

A preset over `SiteMaps.Adapters.S3` (same optional dependencies): the endpoint
is `https://<account_id>.r2.cloudflarestorage.com` (or
`<account_id>.eu.r2.cloudflarestorage.com`), the region is `"auto"`, requests
use path style and no ACL header is ever sent, because R2 has no object ACLs.

    adapter:
      {SiteMaps.Adapters.R2,
       account_id: "0123456789abcdef",
       bucket: "sitemaps",
       prefix: "acme",
       access_key_id: System.fetch_env!("R2_ACCESS_KEY_ID"),
       secret_access_key: System.fetch_env!("R2_SECRET_ACCESS_KEY")}

Files can be served through `SiteMaps.Plug` or straight from a public bucket or
custom domain bound to the bucket.

## Options

* `:account_id` (`t:String.t/0`) - Required. Cloudflare account id.

* `:jurisdiction` - `:eu` targets buckets created in the EU jurisdiction. The default value is `:default`.

* `:bucket` (`t:String.t/0`) - Required. Bucket name.

* `:prefix` (`t:String.t/0`) - Key prefix inside the bucket. The default value is `""`.

* `:access_key_id` (`t:String.t/0`) - R2 API token access key id.

* `:secret_access_key` (`t:String.t/0`) - R2 API token secret access key.

* `:cache_control` (`t:String.t/0`) - Overrides the `cache_control` given by the sitemap configuration.

* `:multipart_threshold` (`t:pos_integer/0`) - Files larger than this many bytes are uploaded in multiple parts. The default value is `8388608`.

* `:part_size` - Size in bytes of each multipart part, at least 5 MiB (5242880). The default value is `5242880`.

* `:ex_aws` (`t:keyword/0`) - Overrides merged last into the ExAws configuration, such as `http_client`. The default value is `[]`.

# `s3_opts`

```elixir
@spec s3_opts(keyword()) :: keyword()
```

Translates R2 options into `SiteMaps.Adapters.S3` options.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
