This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
payload.config.ts
97 lines (94 loc) · 2.29 KB
/
payload.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { buildConfig } from 'payload/config';
import path from 'path';
import { Users } from './collections/Users';
import { Pages } from './collections/Pages';
import { MainMenu } from './globals/MainMenu';
import { cloudStorage } from '@payloadcms/plugin-cloud-storage';
import { s3Adapter } from '@payloadcms/plugin-cloud-storage/s3';
import { Media } from './collections/Media';
import seo from '@payloadcms/plugin-seo';
import { webpackBundler } from '@payloadcms/bundler-webpack';
// import { postgresAdapter } from '@payloadcms/db-postgres';
import { mongooseAdapter } from '@payloadcms/db-mongodb';
// import { slateEditor } from '@payloadcms/richtext-slate';
import type { RichTextAdapter } from 'payload/types';
const adapter = s3Adapter({
config: {
endpoint: process.env.NEXT_PUBLIC_S3_ENDPOINT,
region: process.env.S3_REGION,
forcePathStyle: true,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID as string,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY as string,
}
},
bucket: process.env.NEXT_PUBLIC_S3_BUCKET as string,
})
export function emptyEditor(): RichTextAdapter<any, {}, {}> {
return {
CellComponent: () => null,
FieldComponent: () => null,
outputSchema: () => {
return {
items: {
type: 'object',
},
type: ['array'],
}
},
populationPromise() {
return null
},
validate: () => true,
}
}
export default buildConfig({
// db: postgresAdapter({
// pool: {
// connectionString: process.env.POSTGRES_URI
// }
// }),
db: mongooseAdapter({
url: process.env.MONGODB_URI as string
}),
editor: emptyEditor(),
admin: {
bundler: webpackBundler()
},
collections: [
Pages,
Users,
Media,
{
slug: 'examples',
fields: [
{
name: 'title',
type: 'text',
}
]
}
],
globals: [
MainMenu,
],
typescript: {
outputFile: path.resolve(__dirname, '../payload-types.ts'),
},
graphQL: {
schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
},
plugins: [
seo({
collections: ['pages']
}),
cloudStorage({
collections: {
'media': {
adapter,
disablePayloadAccessControl: true,
}
},
}),
],
});