Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🏗️ Build (push) Failing after 18m25s
Build & Deploy / 🧪 QA (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
128 lines
3.8 KiB
TypeScript
128 lines
3.8 KiB
TypeScript
import { buildConfig } from "payload";
|
|
// Triggering config re-analysis for blocks visibility - V4
|
|
import { postgresAdapter } from "@payloadcms/db-postgres";
|
|
import { lexicalEditor, BlocksFeature } from "@payloadcms/richtext-lexical";
|
|
import { payloadBlocks } from "./src/payload/blocks/allBlocks";
|
|
import { nodemailerAdapter } from "@payloadcms/email-nodemailer";
|
|
import { s3Storage } from "@payloadcms/storage-s3";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
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 { emailWebhookHandler } from "./src/payload/endpoints/emailWebhook";
|
|
import { aiEndpointHandler } from "./src/payload/endpoints/aiEndpoint";
|
|
import { Inquiries } from "./src/payload/collections/Inquiries";
|
|
import { Redirects } from "./src/payload/collections/Redirects";
|
|
import { ContextFiles } from "./src/payload/collections/ContextFiles";
|
|
import { CrmAccounts } from "./src/payload/collections/CrmAccounts";
|
|
import { CrmContacts } from "./src/payload/collections/CrmContacts";
|
|
import { CrmInteractions } from "./src/payload/collections/CrmInteractions";
|
|
import { CrmTopics } from "./src/payload/collections/CrmTopics";
|
|
import { Projects } from "./src/payload/collections/Projects";
|
|
|
|
const filename = fileURLToPath(import.meta.url);
|
|
const dirname = path.dirname(filename);
|
|
|
|
const isCLI =
|
|
process.argv.includes("migrate") ||
|
|
process.argv.includes("generate:importmap");
|
|
let aiPlugin: any;
|
|
if (!isCLI) {
|
|
const { payloadChatPlugin } = await import("@mintel/payload-ai");
|
|
aiPlugin = payloadChatPlugin({
|
|
enabled: true,
|
|
mcpServers: [],
|
|
});
|
|
}
|
|
|
|
export default buildConfig({
|
|
admin: {
|
|
user: Users.slug,
|
|
importMap: {
|
|
baseDir: path.resolve(dirname),
|
|
},
|
|
},
|
|
collections: [
|
|
Users,
|
|
Media,
|
|
Posts,
|
|
Inquiries,
|
|
Redirects,
|
|
ContextFiles,
|
|
CrmAccounts,
|
|
CrmContacts,
|
|
CrmTopics,
|
|
CrmInteractions,
|
|
Projects,
|
|
],
|
|
globals: [
|
|
/* AiSettings as any */
|
|
],
|
|
email: nodemailerAdapter({
|
|
defaultFromAddress: process.env.MAIL_FROM || "info@mintel.me",
|
|
defaultFromName: "Mintel.me",
|
|
transportOptions: {
|
|
host: process.env.MAIL_HOST || "localhost",
|
|
port: parseInt(process.env.MAIL_PORT || "587", 10),
|
|
auth: {
|
|
user: process.env.MAIL_USERNAME || "user",
|
|
pass: process.env.MAIL_PASSWORD || "pass",
|
|
},
|
|
...(process.env.MAIL_HOST ? {} : { ignoreTLS: true }),
|
|
},
|
|
}),
|
|
editor: lexicalEditor({
|
|
features: ({ defaultFeatures }) => [
|
|
...defaultFeatures,
|
|
BlocksFeature({
|
|
blocks: payloadBlocks,
|
|
}),
|
|
],
|
|
}),
|
|
secret: process.env.PAYLOAD_SECRET || "fallback-secret-for-dev",
|
|
typescript: {
|
|
outputFile: path.resolve(dirname, "payload-types.ts"),
|
|
},
|
|
db: postgresAdapter({
|
|
pool: {
|
|
connectionString:
|
|
process.env.DATABASE_URI || process.env.POSTGRES_URI || "",
|
|
},
|
|
}),
|
|
sharp,
|
|
plugins: [
|
|
...(process.env.S3_ENDPOINT
|
|
? [
|
|
s3Storage({
|
|
collections: {
|
|
media: {
|
|
prefix: `${process.env.S3_PREFIX || "mintel-me"}/media`,
|
|
},
|
|
},
|
|
bucket: process.env.S3_BUCKET || "",
|
|
config: {
|
|
credentials: {
|
|
accessKeyId: process.env.S3_ACCESS_KEY || "",
|
|
secretAccessKey: process.env.S3_SECRET_KEY || "",
|
|
},
|
|
region: process.env.S3_REGION || "fsn1",
|
|
endpoint: process.env.S3_ENDPOINT,
|
|
forcePathStyle: true,
|
|
},
|
|
}),
|
|
]
|
|
: []),
|
|
...(aiPlugin ? [aiPlugin] : []),
|
|
],
|
|
endpoints: [
|
|
{
|
|
path: "/crm/incoming-email",
|
|
method: "post",
|
|
handler: emailWebhookHandler,
|
|
},
|
|
],
|
|
});
|