-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayload.config.ts
More file actions
99 lines (93 loc) · 2.63 KB
/
Copy pathpayload.config.ts
File metadata and controls
99 lines (93 loc) · 2.63 KB
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
98
99
// storage-adapter-import-placeholder
import { postgresAdapter } from '@payloadcms/db-postgres'
import { vercelBlobStorage } from '@payloadcms/storage-vercel-blob'
import { resendAdapter } from '@payloadcms/email-resend'
import path from 'path'
import { buildConfig } from 'payload'
import { fileURLToPath } from 'url'
import sharp from 'sharp'
import {
BoldFeature,
ItalicFeature,
LinkFeature,
ParagraphFeature,
lexicalEditor,
UnderlineFeature,
} from '@payloadcms/richtext-lexical'
import { Users } from './collections/Users'
import { Media } from './collections/Media'
import { Blog } from './collections/Blog'
import { Mix } from './collections/Mix'
import { Project } from './collections/Project'
import { Freelance } from './collections/Freelance'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export default buildConfig({
admin: {
user: Users.slug,
importMap: {
baseDir: path.resolve(dirname),
},
},
collections: [Users, Media, Blog, Mix, Project, Freelance],
editor: lexicalEditor({
features({ defaultFeatures }) {
return [
...defaultFeatures,
]
},
// features: [
// ParagraphFeature(),
// UnderlineFeature(),
// BoldFeature(),
// ItalicFeature(),
// LinkFeature({
// enabledCollections: ['blog'],
// fields: ({ defaultFields }) => {
// const defaultFieldsWithoutUrl = defaultFields.filter((field) => {
// if ('name' in field && field.name === 'url') return false
// return true
// })
// return [
// ...defaultFieldsWithoutUrl,
// {
// name: 'url',
// type: 'text',
// admin: {
// condition: (_data, siblingData) => siblingData?.linkType !== 'internal',
// },
// label: ({ t }) => t('fields:enterURL'),
// required: true,
// },
// ]
// },
// }),
// ],
}),
secret: process.env.PAYLOAD_SECRET || '',
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
db: postgresAdapter({
pool: {
connectionString: process.env.DATABASE_URI || '',
idleTimeoutMillis: 10000,
connectionTimeoutMillis: 5000,
allowExitOnIdle: true,
},
}),
sharp,
plugins: [
vercelBlobStorage({
collections: {
media: true,
},
token: process.env.BLOB_READ_WRITE_TOKEN,
}),
],
email: resendAdapter({
defaultFromAddress: 'send@piotrszaran.com',
defaultFromName: 'DJ Pior',
apiKey: process.env.RESEND_API_KEY || '',
})
})