-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayload.config.ts
More file actions
60 lines (57 loc) · 1.93 KB
/
Copy pathpayload.config.ts
File metadata and controls
60 lines (57 loc) · 1.93 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
import { buildConfig } from "payload";
import { lexicalEditor, BlocksFeature } from "@payloadcms/richtext-lexical";
import { MarkdownPasteFeature } from "./features/markdown-paste/feature.server";
import { codeBlock } from "./features/code-block";
import { vercelPostgresAdapter } from "@payloadcms/db-vercel-postgres";
import { resendAdapter } from "@payloadcms/email-resend";
import { vercelBlobStorage } from "@payloadcms/storage-vercel-blob";
import path from "path";
import { fileURLToPath } from "url";
import sharp from "sharp";
import { Users } from "./collections/Users";
import { Posts } from "./collections/Posts";
import { Media } from "./collections/Media";
import { Tags } from "./collections/Tags";
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
export default buildConfig({
admin: {
user: "users",
importMap: {
baseDir: path.resolve(dirname),
},
},
collections: [Users, Posts, Media, Tags],
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
// Fenced code blocks (``` ) — toolbar, markdown typing, and markdown paste.
// codeBlock() relaxes the language field so any fence token is accepted.
BlocksFeature({ blocks: [codeBlock()] }),
MarkdownPasteFeature(),
],
}),
secret: process.env.PAYLOAD_SECRET || "CHANGE-ME-IN-PRODUCTION",
typescript: {
outputFile: path.resolve(dirname, "payload-types.ts"),
},
db: vercelPostgresAdapter({
pool: {
connectionString: process.env.DATABASE_URI || "",
},
}),
email: resendAdapter({
defaultFromAddress: process.env.RESEND_FROM_ADDRESS || "onboarding@resend.dev",
defaultFromName: process.env.RESEND_FROM_NAME || "celeroncoder",
apiKey: process.env.RESEND_API_KEY || "",
}),
plugins: [
vercelBlobStorage({
collections: {
media: true,
},
token: process.env.BLOB_READ_WRITE_TOKEN,
}),
],
sharp,
});