feat: add support for s3 bucket for media
This commit is contained in:
@@ -2,3 +2,8 @@ VITE_API_URL=
|
|||||||
|
|
||||||
CMS_SECRET=
|
CMS_SECRET=
|
||||||
CMS_POSTGRES_URL=
|
CMS_POSTGRES_URL=
|
||||||
|
|
||||||
|
CMS_STORAGE_ENDPOINT=
|
||||||
|
CMS_STORAGE_ACCESS_KEY_ID=
|
||||||
|
CMS_STORAGE_SECRET_ACCESS_KEY=
|
||||||
|
CMS_STORAGE_REGION=ap-southeast-1
|
||||||
|
|||||||
@@ -1 +1,6 @@
|
|||||||
export const importMap = {};
|
import { S3ClientUploadHandler as S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24 } from '@payloadcms/storage-s3/client';
|
||||||
|
|
||||||
|
export const importMap = {
|
||||||
|
'@payloadcms/storage-s3/client#S3ClientUploadHandler':
|
||||||
|
S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24,
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { postgresAdapter } from '@payloadcms/db-postgres';
|
import { postgresAdapter } from '@payloadcms/db-postgres';
|
||||||
import { lexicalEditor } from '@payloadcms/richtext-lexical';
|
import { lexicalEditor } from '@payloadcms/richtext-lexical';
|
||||||
|
import { s3Storage } from '@payloadcms/storage-s3';
|
||||||
|
import { NodeHttpHandler } from '@smithy/node-http-handler';
|
||||||
|
import https from 'https';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { buildConfig } from 'payload';
|
import { buildConfig } from 'payload';
|
||||||
import sharp from 'sharp';
|
import sharp from 'sharp';
|
||||||
@@ -40,5 +43,26 @@ export default buildConfig({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
sharp,
|
sharp,
|
||||||
plugins: [],
|
plugins: [
|
||||||
|
s3Storage({
|
||||||
|
collections: {
|
||||||
|
media: {
|
||||||
|
disableLocalStorage: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
bucket: 'landing-cms',
|
||||||
|
config: {
|
||||||
|
endpoint: process.env.CMS_STORAGE_ENDPOINT,
|
||||||
|
credentials: {
|
||||||
|
accessKeyId: process.env.CMS_STORAGE_ACCESS_KEY_ID!,
|
||||||
|
secretAccessKey: process.env.CMS_STORAGE_SECRET_ACCESS_KEY!,
|
||||||
|
},
|
||||||
|
region: process.env.CMS_STORAGE_REGION!,
|
||||||
|
forcePathStyle: true,
|
||||||
|
requestHandler: new NodeHttpHandler({
|
||||||
|
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
Generated
+1758
-21
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,9 @@
|
|||||||
"@payloadcms/db-postgres": "^3.37.0",
|
"@payloadcms/db-postgres": "^3.37.0",
|
||||||
"@payloadcms/next": "^3.37.0",
|
"@payloadcms/next": "^3.37.0",
|
||||||
"@payloadcms/richtext-lexical": "^3.37.0",
|
"@payloadcms/richtext-lexical": "^3.37.0",
|
||||||
|
"@payloadcms/storage-s3": "^3.37.0",
|
||||||
"@radix-ui/react-slot": "^1.2.0",
|
"@radix-ui/react-slot": "^1.2.0",
|
||||||
|
"@smithy/node-http-handler": "^4.0.4",
|
||||||
"@tanstack/react-query": "^5.74.4",
|
"@tanstack/react-query": "^5.74.4",
|
||||||
"@tanstack/react-store": "^0.7.0",
|
"@tanstack/react-store": "^0.7.0",
|
||||||
"@tanstack/react-table": "^8.21.2",
|
"@tanstack/react-table": "^8.21.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user