37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { buildConfig } from 'payload'
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
|
import { Users } from './payload/collections/Users'
|
|
import { Services } from './payload/collections/Services'
|
|
import { Realisations } from './payload/collections/Realisations'
|
|
import { Articles } from './payload/collections/Articles'
|
|
import { Testimonials } from './payload/collections/Testimonials'
|
|
import { FAQ } from './payload/collections/FAQ'
|
|
import { Media } from './payload/collections/Media'
|
|
|
|
const serverURL = process.env.NEXT_PUBLIC_SERVER_URL || ''
|
|
|
|
export default buildConfig({
|
|
secret: process.env.PAYLOAD_SECRET || 'change-moi',
|
|
serverURL,
|
|
// csrf: Payload auto-populates from serverURL when non-empty.
|
|
// When serverURL is empty, csrf stays [] → all origins accepted (dev-safe).
|
|
// cors: Allow the public origin to call the REST API from the browser.
|
|
cors: serverURL ? [serverURL] : '*',
|
|
editor: lexicalEditor(),
|
|
routes: {
|
|
admin: '/gestion59',
|
|
},
|
|
admin: {
|
|
user: 'users',
|
|
},
|
|
db: postgresAdapter({
|
|
pool: {
|
|
connectionString: process.env.DATABASE_URL!,
|
|
},
|
|
push: true,
|
|
}),
|
|
collections: [Users, Services, Realisations, Articles, Testimonials, FAQ, Media],
|
|
globals: [],
|
|
})
|