Drafts are on so a post can be written across sittings without saving being publishing. afterChange and afterDelete revalidate every path a post appears on. Blog pages are ISR because CI builds with no database, so without these a published post would not appear until the revalidate window expired — up to an hour of a writer concluding that publishing is broken. Payload runs in the same process as Next, so these are direct revalidatePath calls with no webhook and no shared secret. Media writes to an absolute /app/media matching the compose mount; a mismatch would write into the container filesystem, where the next redeploy silently discards it. Alt text is required rather than optional. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017YmbBhr8s7GusjDE12hrZM
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
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 { Posts } from '@/collections/Posts';
|
|
import { Media } from '@/collections/Media';
|
|
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, Posts, Media],
|
|
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,
|
|
});
|