Repository navigation
Expand file tree
/
Copy pathpayload.config.ts
More file actions
68 lines (64 loc) · 2.28 KB
/
Copy pathpayload.config.ts
File metadata and controls
68 lines (64 loc) · 2.28 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
import path from 'path'
import { fileURLToPath } from 'url'
import { buildConfig } from 'payload'
import { sqliteAdapter } from '@payloadcms/db-sqlite'
import { lexicalEditor, UploadFeature, BlocksFeature } from '@payloadcms/richtext-lexical'
import sharp from 'sharp'
import { Users } from './src/payload/collections/Users'
import { Media } from './src/payload/collections/Media'
import { Posts } from './src/payload/collections/Posts'
import { News } from './src/payload/collections/News'
import { HelpArticles } from './src/payload/collections/HelpArticles'
import { GitHubReleaseBlock } from './src/payload/blocks/GitHubReleaseBlock'
import { migrations } from './src/migrations'
import { assertRequiredEnv } from './src/lib/env'
const dirname = path.dirname(fileURLToPath(import.meta.url))
assertRequiredEnv()
const payloadSecret = process.env.PAYLOAD_SECRET
export default buildConfig({
admin: {
user: Users.slug,
importMap: { baseDir: path.resolve(dirname) },
},
// Content first in the sidebar, admin collections last.
collections: [HelpArticles, Posts, News, Media, Users],
// Enable inline uploads (with a caption field) and the GitHubRelease block so
// the migrated <ClickableImage>/<GitHubRelease> content validates and renders.
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
UploadFeature({
collections: {
media: {
fields: [{ name: 'caption', type: 'text' }],
},
},
}),
BlocksFeature({ blocks: [GitHubReleaseBlock] }),
],
}),
secret: payloadSecret || '',
...(process.env.NEXT_PUBLIC_SERVER_URL
? {
cors: [process.env.NEXT_PUBLIC_SERVER_URL],
csrf: [process.env.NEXT_PUBLIC_SERVER_URL],
}
: {}),
graphQL: { disablePlaygroundInProduction: true },
db: sqliteAdapter({
client: { url: process.env.DATABASE_URI || 'file:./data/payload.db' },
// Only use explicit migrations, also in dev.
push: false,
migrationDir: path.resolve(dirname, 'src/migrations'),
// Run pending migrations automatically on startup in production.
prodMigrations: migrations,
}),
sharp,
localization: {
locales: ['en', 'nl'],
defaultLocale: 'en',
},
typescript: {
outputFile: path.resolve(dirname, 'src/payload-types.ts'),
},
})