Files
ipal-kit/reference/src/payload.config.ts
T
Radosław SmolińskiandClaude Fable 5.2 b6c91a3a11 Sign-in look: the client's logo or the site's name on a dark panel beside the form (whiteLabel.signIn)
On by default with whiteLabel. The login screen and the 2FA screens get the look through AdminLogo and
SafeTotpView, which every site already has in its import map: an upgrade needs no edit. allScreens adds one
provider (SignInLook) for forgot / reset password, first user and logout; a production start leaves it out
when the import map on disk lacks it. Logo and name come from Site settings: no new field, no migration.
Language links through GET /api/ipal/admin-language (Payload's own cookie, back to an admin path only).
Options: accent, logoMadeFor, languages, svgLogo; whiteLabel.brandAccess 'admin'. The 2FA code boxes get
names for screen readers. Reference site and starter: allScreens on. Docs, agent guide, skills, tests.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-26 20:35:33 +01:00

133 lines
5.2 KiB
TypeScript

// @starter:if twoFactor
import { payloadTotp } from '@clocklimited/payload-2fa'
// @starter:endif
import { buildR2Storage, iapl, 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
// @starter:if demo
import { E2E_LATE_STAFF, E2E_STAFF_SLUGS, e2eEarlyStaff, e2eLateStaff } from '../e2e/late-staff-fixture'
import { e2eDevelopmentHosts, e2eMail } from '../e2e/mail-relay-fixture'
// @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,
// iapl 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(), // the Intecion mail service, or the SMTP server from Site integrations; without it form e-mails are not sent
secret: process.env.PAYLOAD_SECRET ?? '',
sharp,
typescript: { outputFile: path.resolve(dirname, 'payload-types.ts') },
plugins: [
// @starter:if demo
e2eEarlyStaff, // a test fixture, a no-op without E2E_LATE_STAFF=1 (e2e/late-staff-fixture.ts)
// @starter:endif
iapl({
i18n: i18nConfig,
// a site made since 1.17.0: the 2FA counter key and the statistics cookie carry the new spelling (docs/stats.md);
// with `stats` on, the layout passes visitorCookie={IAPL_VISITOR_COOKIE} to match
storageNames: 'iapl',
// @starter:if demo
// a test fixture: `undefined` (the plugin's defaults) without E2E_MAIL_RELAY_URL (e2e/mail-relay-fixture.ts)
mail: e2eMail,
// a test fixture: `undefined` (the built-in list) without E2E_DEVELOPMENT_HOSTS
developmentHosts: e2eDevelopmentHosts,
// (the staffCollections entry exists only for e2e/late-staff.spec.ts, with E2E_LATE_STAFF=1)
access: { authCollection: 'users', ...(E2E_LATE_STAFF ? { staffCollections: E2E_STAFF_SLUGS } : {}) },
// @starter:else
//: access: { authCollection: 'users' },
// @starter:endif
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, iapl-doctor.json
// @starter:endif
// @starter:if whiteLabel
// the sign-in look on every sign-in screen: one admin provider, in the import map (white-label.md)
whiteLabel: { signIn: { allScreens: 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: on by default (1.17.0) — Privacy → Consent records; `consentLog: false` turns it off
// Privacy → Cookie review: scan + approval; crawl needs IAPL_COOKIE_SCAN_URL / IAPL_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
// @starter:if demo
e2eLateStaff, // a test fixture, a no-op without E2E_LATE_STAFF=1 (e2e/late-staff-fixture.ts)
// @starter:endif
],
})