import { sqliteAdapter } from '@payloadcms/db-sqlite' import { lexicalEditor } from '@payloadcms/richtext-lexical' import { ipalKit } 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: [ ipalKit({ access: { authCollection: 'users' }, i18n: i18nConfig, consentLog: true, forms: {}, seo: { collections: ['posts', 'pages'] }, stats: true, // 2FA is enforced by default; the dev sandbox opts out so it boots without an authenticator. twoFactor: false, }), ], secret: process.env.PAYLOAD_SECRET || 'test-secret_key', sharp, typescript: { outputFile: path.resolve(dirname, 'payload-types.ts'), }, })