Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 5s
Build & Deploy / 🧪 QA (push) Failing after 1m12s
Build & Deploy / 🏗️ Build (push) Failing after 3m58s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s
95 lines
2.9 KiB
TypeScript
95 lines
2.9 KiB
TypeScript
import { buildConfig } from "payload";
|
||
import { postgresAdapter } from "@payloadcms/db-postgres";
|
||
import { lexicalEditor, BlocksFeature } from "@payloadcms/richtext-lexical";
|
||
import { nodemailerAdapter } from "@payloadcms/email-nodemailer";
|
||
import { s3Storage } from "@payloadcms/storage-s3";
|
||
import sharp from "sharp";
|
||
import path from "path";
|
||
import { fileURLToPath } from "url";
|
||
import { payloadBlocks } from "./blocks/allBlocks";
|
||
import { migrations } from "../../migrations/index";
|
||
|
||
import { Users } from "./collections/Users";
|
||
import { Media } from "./collections/Media";
|
||
import { FormSubmissions } from "./collections/FormSubmissions";
|
||
import { Pages } from "./collections/Pages";
|
||
|
||
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: " – MB Grid Solutions",
|
||
},
|
||
},
|
||
collections: [Users, Media, FormSubmissions, Pages],
|
||
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({
|
||
migrations,
|
||
pool: {
|
||
connectionString:
|
||
process.env.DATABASE_URI ||
|
||
process.env.POSTGRES_URI ||
|
||
`postgresql://${process.env.DIRECTUS_DB_USER || "directus"}:${process.env.DIRECTUS_DB_PASSWORD || "directus"}@127.0.0.1:5432/${process.env.DIRECTUS_DB_NAME || "directus"}`,
|
||
},
|
||
}),
|
||
...(process.env.SMTP_HOST
|
||
? {
|
||
email: nodemailerAdapter({
|
||
defaultFromAddress:
|
||
process.env.SMTP_FROM || "info@mb-grid-solutions.com",
|
||
defaultFromName: "MB Grid Solutions CMS",
|
||
transportOptions: {
|
||
host: process.env.SMTP_HOST,
|
||
port: parseInt(process.env.SMTP_PORT || "587"),
|
||
auth: {
|
||
user: process.env.SMTP_USER,
|
||
pass: process.env.SMTP_PASS,
|
||
},
|
||
secure: process.env.SMTP_SECURE === "true",
|
||
},
|
||
}),
|
||
}
|
||
: {}),
|
||
sharp,
|
||
plugins: [
|
||
...(process.env.S3_ENDPOINT
|
||
? [
|
||
s3Storage({
|
||
collections: {
|
||
media: {
|
||
prefix: `${process.env.S3_PREFIX || "mb-grid-solutions"}/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,
|
||
},
|
||
}),
|
||
]
|
||
: []),
|
||
],
|
||
});
|