R2 storage from env + filename normalization
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
import type { Plugin } from 'payload';
|
||||
/**
|
||||
* Cloudflare R2 media storage — configured from environment variables (agency
|
||||
* infrastructure, not per-project panel data). R2 is S3-compatible, so we use
|
||||
* @payloadcms/storage-s3 pointed at the R2 endpoint.
|
||||
*
|
||||
* Storage is infrastructure (like the database or PAYLOAD_SECRET): it binds at
|
||||
* boot, and its credentials are agency-owned — so it lives in .env, not the
|
||||
* panel. See docs/storage.md for the required variables.
|
||||
*
|
||||
* Returns the storage plugin when all R2 vars are present; otherwise returns a
|
||||
* no-op passthrough so the project falls back to Payload's default local disk
|
||||
* storage (useful in dev without R2). This mirrors how mailAdapter degrades
|
||||
* gracefully when a transport isn't configured.
|
||||
*
|
||||
* @param collections - slugs of upload collections to offload to R2 (e.g. ['media'])
|
||||
*/
|
||||
export declare const buildR2Storage: (collections?: string[]) => Plugin;
|
||||
Reference in New Issue
Block a user