SiteMaps.Adapters.R2 (site_maps v0.1.0)

Copy Markdown View Source

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 (String.t/0) - Required. Cloudflare account id.

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

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

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

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

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

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

  • :multipart_threshold (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 (keyword/0) - Overrides merged last into the ExAws configuration, such as http_client. The default value is [].

Summary

Functions

Translates R2 options into SiteMaps.Adapters.S3 options.

Functions

s3_opts(opts)

@spec s3_opts(keyword()) :: keyword()

Translates R2 options into SiteMaps.Adapters.S3 options.