79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
// storage-adapter-import-placeholder
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
|
import { nodemailerAdapter } from '@payloadcms/email-nodemailer'
|
|
import path from 'path'
|
|
import { buildConfig } from 'payload'
|
|
import { fileURLToPath } from 'url'
|
|
import sharp from 'sharp'
|
|
|
|
import { Users } from './collections/Users'
|
|
import { Media } from './collections/Media'
|
|
import { Books } from './collections/Books/Books'
|
|
import { Authors } from './collections/Authors/Authors'
|
|
import { Repositories } from './collections/Repositories/Repositories'
|
|
import { Copies } from './collections/Copies/Copies'
|
|
import { Genre } from './collections/Books/Genre'
|
|
import { Header } from './globals/header/config'
|
|
import { Pages } from './collections/Pages/Pages'
|
|
import HoldRequests from './collections/Checkouts/HoldRequests'
|
|
import Checkouts from './collections/Checkouts/Checkouts'
|
|
|
|
import './envConfig.ts'
|
|
|
|
const filename = fileURLToPath(import.meta.url)
|
|
const dirname = path.dirname(filename)
|
|
|
|
export default buildConfig({
|
|
admin: {
|
|
user: Users.slug,
|
|
importMap: {
|
|
baseDir: path.resolve(dirname),
|
|
},
|
|
dateFormat: 'MM/dd/yyyy',
|
|
},
|
|
cors: [process.env.SERVER_URL || ''],
|
|
csrf: [process.env.SERVER_URL || ''],
|
|
upload: {
|
|
limits: {
|
|
fileSize: 5000000, // in bytes
|
|
},
|
|
},
|
|
globals: [Header],
|
|
collections: [Users, Media, Books, Authors, Repositories, Copies, HoldRequests, Checkouts, Genre, Pages],
|
|
editor: lexicalEditor(),
|
|
secret: process.env.PAYLOAD_SECRET || '',
|
|
typescript: {
|
|
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
|
},
|
|
db: postgresAdapter({
|
|
pool: {
|
|
connectionString: process.env.DATABASE_URI || '',
|
|
},
|
|
}),
|
|
email: nodemailerAdapter({
|
|
defaultFromAddress: 'no-reply@beitzah.net',
|
|
defaultFromName: 'no-reply Beitzah',
|
|
transportOptions: {
|
|
host: process.env.SMTP_HOST,
|
|
port: parseInt(process.env.SMTP_PORT || '', 10),
|
|
auth: {
|
|
user: process.env.SMTP_USER,
|
|
pass: process.env.SMTP_PASS,
|
|
},
|
|
},
|
|
}),
|
|
sharp,
|
|
plugins: [
|
|
//payloadCloudPlugin(),
|
|
// storage-adapter-placeholder
|
|
],
|
|
hooks: {
|
|
afterError: [
|
|
(error) => {
|
|
console.log(error)
|
|
}
|
|
],
|
|
},
|
|
})
|