Files
ipal-kit/reference/src/payload.config.ts
T

110 lines
3.7 KiB
TypeScript

// @starter:if twoFactor
import { payloadTotp } from '@clocklimited/payload-2fa'
// @starter:endif
import { buildR2Storage, ipalKit, mailAdapter } from '@intecion/ipal-kit'
import { lexicalEditor } from '@payloadcms/richtext-lexical'
import { s3Storage } from '@payloadcms/storage-s3'
import { revalidatePath } from 'next/cache'
import path from 'path'
import { buildConfig } from 'payload'
import sharp from 'sharp'
import { fileURLToPath } from 'url'
// @starter:if caseStudies
import { CaseStudies } from './collections/CaseStudies'
// @starter:endif
import { Media } from './collections/Media'
import { Pages } from './collections/Pages'
// @starter:if posts
import { Posts } from './collections/Posts'
// @starter:endif
import { contentConfig } from './content.config'
import { db } from './db'
import { Company } from './globals/Company'
import { Footer } from './globals/Footer'
import { Header } from './globals/Header'
import { i18nConfig } from './i18n.config'
const dirname = path.dirname(fileURLToPath(import.meta.url))
export default buildConfig({
admin: {
user: 'users',
importMap: { baseDir: path.resolve(dirname) },
},
// absolute URLs in form e-mails (logo, links)
serverURL: process.env.NEXT_PUBLIC_SERVER_URL,
// ipalKit injects `users` (roles + 2FA)
collections: [
Pages,
// @starter:if posts
Posts,
// @starter:endif
// @starter:if caseStudies
CaseStudies,
// @starter:endif
Media,
],
globals: [Header, Footer, Company],
db,
editor: lexicalEditor(),
email: mailAdapter(), // transport from Site integrations (SMTP / Graph); without it form e-mails are not sent
secret: process.env.PAYLOAD_SECRET ?? '',
sharp,
typescript: { outputFile: path.resolve(dirname, 'payload-types.ts') },
plugins: [
ipalKit({
i18n: i18nConfig,
access: { authCollection: 'users' },
pages: { slug: 'pages' },
content: contentConfig,
seo: {
collections: [
'pages',
// @starter:if posts
'posts',
// @starter:endif
// @starter:if caseStudies
'caseStudies',
// @starter:endif
],
},
// @starter:if demo
// attachments: the Quote form takes floor plans and photos — e-mailed to the studio, never stored (forms.md "Files")
forms: { attachments: true, emailLayout: true, redirectRelationships: ['pages'] },
// @starter:else
//: forms: { redirectRelationships: ['pages'], emailLayout: true }, // files on forms: add `attachments: true` (forms.md "Files")
// @starter:endif
// @starter:if twoFactor
twoFactor: { issuer: 'Example Studio', plugin: payloadTotp },
// @starter:else
//: twoFactor: false, // turned off by the owner — AGENTS.md → Project decisions, ipal-doctor.json
// @starter:endif
// @starter:if whiteLabel
whiteLabel: true,
// @starter:endif
// @starter:if !adminMeta
//: adminMeta: false, // turned off by the owner — AGENTS.md → Project decisions
// @starter:endif
// @starter:if agencyNone
//: agency: false, // no agency credit (owner's choice)
// @starter:endif
// @starter:if agencyCustom
//: agency: { name: 'Example Agency', url: 'https://agency.example' },
// @starter:endif
indexNow: true,
consentLog: true,
// Privacy → Cookie review: scan + approval; crawl needs IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN
// @starter:if crawl
cookieScanner: { crawl: true },
// @starter:endif
// @starter:if scannerWithoutCrawl
//: cookieScanner: true,
// @starter:endif
lightbox: true,
revalidatePath,
}),
buildR2Storage(['media'], { s3Storage }), // R2 with the full R2_* set, local disk without it
],
})