add cloudflare R2 config

This commit is contained in:
2025-10-13 11:37:20 +08:00
parent 8e8ff0bfc7
commit 65c27e3386
13 changed files with 17839 additions and 179 deletions

View File

@@ -5,7 +5,7 @@ import sharp from 'sharp' // sharp-import
import path from 'path'
import { buildConfig, PayloadRequest } from 'payload'
import { fileURLToPath } from 'url'
import { r2Storage } from '@payloadcms/storage-r2'
import { Categories } from './collections/Categories'
import { Media } from './collections/Media'
import { Pages } from './collections/Pages'
@@ -70,8 +70,11 @@ export default buildConfig({
].filter(Boolean),
globals: [Header, Footer],
plugins: [
...plugins,
// storage-adapter-placeholder
r2Storage({
bucket: cloudflare.env.R2,
collections: { media: true },
}),
],
secret: process.env.PAYLOAD_SECRET,
sharp,