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
|
import { buildConfig } from 'payload';
import { postgresAdapter } from '@payloadcms/db-postgres';
import { lexicalEditor } from '@payloadcms/richtext-lexical';
import path from 'path';
import { fileURLToPath } from 'url';
import sharp from 'sharp';
import { Users } from './src/payload/collections/Users';
import { Posts } from './src/payload/collections/Posts';
import { Media } from './src/payload/collections/Media';
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
export default buildConfig({
admin: {
user: Users.slug,
importMap: {
baseDir: path.resolve(dirname),
},
meta: {
titleSuffix: ' - Blog Admin',
},
autoLogin:
process.env.NODE_ENV === 'development'
? {
email: 'admin@example.com',
password: 'admin123',
prefillOnly: true,
}
: false,
},
i18n: {
fallbackLanguage: 'en',
},
collections: [Users, Posts, Media],
editor: lexicalEditor(),
secret: process.env.PAYLOAD_SECRET || 'your-secret-key',
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
db: postgresAdapter({
pool: {
connectionString: process.env.DATABASE_URL || '',
},
schemaName: 'payload',
push: false,
}),
sharp,
});
|