import path from 'path'; import { fileURLToPath } from 'url'; import { buildConfig } from 'payload'; import { postgresAdapter } from '@payloadcms/db-postgres'; import { lexicalEditor } from '@payloadcms/richtext-lexical'; import sharp from 'sharp'; import { Users } from '@/collections/Users'; import { PAYLOAD_API_ROUTE, PAYLOAD_ADMIN_ROUTE } from '@/lib/payloadRoutes'; const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename); export default buildConfig({ admin: { user: Users.slug }, // Defined in lib/payloadRoutes.ts, which carries the reasoning and is what // the test asserts. Never inline these — /api belongs to the FastAPI proxy. routes: { api: PAYLOAD_API_ROUTE, admin: PAYLOAD_ADMIN_ROUTE }, collections: [Users], editor: lexicalEditor(), secret: process.env.PAYLOAD_SECRET || '', typescript: { outputFile: path.resolve(dirname, 'payload-types.ts') }, db: postgresAdapter({ pool: { connectionString: process.env.DATABASE_URL }, // Its own schema, so no pipeline operation on `public` can reach blog // content. scripts/migrate_csv_to_db.py --drop lives in that blast radius, // as does Airflow's metadata. schemaName: 'payload', }), sharp, });