Skip to main content

R2_BUCKET

Constant R2_BUCKET 

Source
pub const R2_BUCKET: &str = "R2_BUCKET";
Expand description

Worker variable holding the R2 bucket name (<app>-storage), for presigned R2 URLs.

The STORAGE binding knows its bucket, but R2’s S3 API needs the name in the URL: set R2_BUCKET: bindings.text("<app>-storage"), in worker.env.

§Examples

assert_eq!(ocre::storage::R2_BUCKET, "R2_BUCKET");