Replaced by an explicit list of forms only (ten exported names, runtime env names, project file names and marks, commands, skill names, the log prefix, the brand in prose). Package name, import paths, routes, CSS tokens, data attributes, custom keys, context flags, the cookie and kv keys are not touched. package.json keeps the five old bin names beside the five new ones. The old names stop working in this commit and come back as aliases in the next; docs follow. Co-Authored-By: Claude Fable 5.2 <[email protected]>
92 lines
2.7 KiB
TypeScript
92 lines
2.7 KiB
TypeScript
import { payloadTotp } from '@clocklimited/payload-2fa'
|
|
import { sqliteAdapter } from '@payloadcms/db-sqlite'
|
|
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
|
import { iapl } from '../src/index.js'
|
|
import path from 'path'
|
|
import { buildConfig } from 'payload'
|
|
import sharp from 'sharp'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
import { testEmailAdapter } from './helpers/testEmailAdapter.js'
|
|
import { i18nConfig } from './i18n.config.js'
|
|
import { seed } from './seed.js'
|
|
|
|
const filename = fileURLToPath(import.meta.url)
|
|
const dirname = path.dirname(filename)
|
|
|
|
if (!process.env.ROOT_DIR) {
|
|
process.env.ROOT_DIR = dirname
|
|
}
|
|
|
|
export default buildConfig({
|
|
admin: {
|
|
importMap: {
|
|
baseDir: path.resolve(dirname),
|
|
},
|
|
},
|
|
collections: [
|
|
{
|
|
slug: 'users',
|
|
auth: true,
|
|
fields: [],
|
|
},
|
|
{
|
|
slug: 'pages',
|
|
fields: [
|
|
{ name: 'title', type: 'text', localized: true },
|
|
{ name: 'slug', type: 'text', index: true, localized: true },
|
|
{
|
|
name: 'layout',
|
|
type: 'blocks',
|
|
blocks: [{ slug: 'formBlock', fields: [{ name: 'form', type: 'relationship', relationTo: 'forms' }] }],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
slug: 'posts',
|
|
fields: [{ name: 'title', type: 'text' }],
|
|
},
|
|
{
|
|
slug: 'media',
|
|
fields: [],
|
|
upload: { staticDir: path.resolve(dirname, 'media') },
|
|
},
|
|
],
|
|
|
|
db: sqliteAdapter({
|
|
client: {
|
|
url: process.env.DATABASE_URI || 'file:./payload.db',
|
|
},
|
|
}),
|
|
editor: lexicalEditor(),
|
|
email: testEmailAdapter,
|
|
onInit: async (payload) => {
|
|
await seed(payload)
|
|
},
|
|
plugins: [
|
|
iapl({
|
|
access: { authCollection: 'users' },
|
|
i18n: i18nConfig,
|
|
consentLog: true,
|
|
// Cookie review + "Crawl site" (needs IAPL_COOKIE_SCAN_URL / IAPL_COOKIE_SCAN_TOKEN and a running services/cookie-crawler).
|
|
cookieScanner: { crawl: true },
|
|
forms: {},
|
|
seo: { collections: ['posts', 'pages'] },
|
|
stats: true,
|
|
// 2FA is enforced by default; the dev sandbox opts out so it boots without an authenticator.
|
|
// IPAL_DEV_2FA=1 turns it on (first-login setup and verify screens).
|
|
twoFactor: process.env.IPAL_DEV_2FA ? { issuer: 'IAPL dev', plugin: payloadTotp } : false,
|
|
// Panel logo/icon from Site settings and the technology support credit.
|
|
whiteLabel: true,
|
|
}),
|
|
],
|
|
secret: process.env.PAYLOAD_SECRET || 'test-secret_key',
|
|
sharp,
|
|
typescript: {
|
|
// Payload's dev init spawns `payload generate:types` on every start/recompile and never
|
|
// reaps it, so each restart left an orphan. Run `pnpm generate:types` when types change.
|
|
autoGenerate: false,
|
|
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
|
},
|
|
})
|