- adminMeta (default on, with or without whiteLabel): robots noindex/nofollow, title suffix "— <site> | Panel", og:site_name and en/pl description from Site settings, preview image GET /api/ipal/admin-og (next/og, from the logo or name, no external service) and icon GET /api/ipal/admin-icon - the site name sits in a process-wide store read through getters, so link previews stay current after a Site settings save and across config loads - agency option (default Intecion.com) feeds the credit, description and image; credit reads "Technology support: Intecion.com" (pl: Wsparcie technologiczne) - the project's own admin.meta keys always win; adminMeta: false / agency: false - dev: whiteLabel on; docs: white-label.md, AGENT.md, ipal-reference/setup/upgrade Co-Authored-By: Claude Opus 5.5 <[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 { 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,
|
|
// Cookie review + "Crawl site" (needs IPAL_COOKIE_SCAN_URL / IPAL_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: 'ipal-kit 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'),
|
|
},
|
|
})
|