update r2 config for enchunCMS email adapter
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// storage-adapter-import-placeholder
|
||||
import { mongooseAdapter } from '@payloadcms/db-mongodb'
|
||||
|
||||
import { s3Storage } from '@payloadcms/storage-s3'
|
||||
import { resendAdapter } from '@payloadcms/email-resend'
|
||||
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'
|
||||
@@ -69,11 +69,27 @@ export default buildConfig({
|
||||
'http://localhost:8788', // Wrangler Pages dev server
|
||||
].filter(Boolean),
|
||||
globals: [Header, Footer],
|
||||
email: resendAdapter({
|
||||
defaultFromAddress: 'dev@resend.com',
|
||||
defaultFromName: '恩群數位行銷',
|
||||
apiKey: process.env.RESEND_API_KEY || '',
|
||||
}),
|
||||
plugins: [
|
||||
// storage-adapter-placeholder
|
||||
r2Storage({
|
||||
bucket: cloudflare.env.R2,
|
||||
collections: { media: true },
|
||||
...plugins,
|
||||
s3Storage({
|
||||
collections: {
|
||||
media: true,
|
||||
},
|
||||
bucket: process.env.R2_BUCKET!,
|
||||
config: {
|
||||
endpoint: `https://${process.env.R2_ACCOUNT_ID!}.r2.cloudflarestorage.com`,
|
||||
credentials: {
|
||||
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
|
||||
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
|
||||
},
|
||||
region: 'auto',
|
||||
// ... Other S3 configuration
|
||||
},
|
||||
}),
|
||||
],
|
||||
secret: process.env.PAYLOAD_SECRET,
|
||||
|
||||
Reference in New Issue
Block a user