92 lines
2.8 KiB
TypeScript
92 lines
2.8 KiB
TypeScript
|
|
import path from 'node:path'
|
||
|
|
import { fileURLToPath } from 'node:url'
|
||
|
|
import { buildConfig } from 'payload'
|
||
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
||
|
|
import { en } from '@payloadcms/translations/languages/en'
|
||
|
|
import { zh } from '@payloadcms/translations/languages/zh'
|
||
|
|
import sharp from 'sharp'
|
||
|
|
import { eversoloRichTextEditor } from './payload/rich-text-editor'
|
||
|
|
import { Media } from './payload/collections/Media'
|
||
|
|
import { Files } from './payload/collections/Files'
|
||
|
|
import { Videos } from './payload/collections/Videos'
|
||
|
|
import { Products } from './payload/collections/Products'
|
||
|
|
import { ProductCategories } from './payload/collections/ProductCategories'
|
||
|
|
import { Downloads } from './payload/collections/Downloads'
|
||
|
|
import { FAQs } from './payload/collections/FAQs'
|
||
|
|
import { Dealers } from './payload/collections/Dealers'
|
||
|
|
import { News } from './payload/collections/News'
|
||
|
|
import { Redirects } from './payload/collections/Redirects'
|
||
|
|
import { Users } from './payload/collections/Users'
|
||
|
|
import { ProductVideos } from './payload/collections/ProductVideos'
|
||
|
|
import { ProductReviews } from './payload/collections/ProductReviews'
|
||
|
|
import { AfterServiceRequests } from './payload/collections/AfterServiceRequests'
|
||
|
|
import { DistributorRequests } from './payload/collections/DistributorRequests'
|
||
|
|
import { OemRequests } from './payload/collections/OemRequests'
|
||
|
|
import { Homepage } from './payload/globals/Homepage'
|
||
|
|
import { GlobalSettings } from './payload/globals/GlobalSettings'
|
||
|
|
import { AboutPage } from './payload/globals/AboutPage'
|
||
|
|
import { SupportPage } from './payload/globals/SupportPage'
|
||
|
|
import { ContactPage } from './payload/globals/ContactPage'
|
||
|
|
import { WarrantyPage } from './payload/globals/WarrantyPage'
|
||
|
|
|
||
|
|
const filename = fileURLToPath(import.meta.url)
|
||
|
|
const dirname = path.dirname(filename)
|
||
|
|
|
||
|
|
export default buildConfig({
|
||
|
|
admin: {
|
||
|
|
user: Users.slug,
|
||
|
|
},
|
||
|
|
i18n: {
|
||
|
|
fallbackLanguage: 'en',
|
||
|
|
supportedLanguages: {
|
||
|
|
en,
|
||
|
|
zh,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
editor: eversoloRichTextEditor,
|
||
|
|
collections: [
|
||
|
|
Users,
|
||
|
|
Media,
|
||
|
|
Files,
|
||
|
|
Videos,
|
||
|
|
Products,
|
||
|
|
ProductCategories,
|
||
|
|
Downloads,
|
||
|
|
FAQs,
|
||
|
|
Dealers,
|
||
|
|
News,
|
||
|
|
ProductVideos,
|
||
|
|
ProductReviews,
|
||
|
|
AfterServiceRequests,
|
||
|
|
DistributorRequests,
|
||
|
|
OemRequests,
|
||
|
|
Redirects,
|
||
|
|
],
|
||
|
|
globals: [Homepage, GlobalSettings, AboutPage, SupportPage, ContactPage, WarrantyPage],
|
||
|
|
localization: {
|
||
|
|
locales: [
|
||
|
|
{ label: 'English', code: 'en' },
|
||
|
|
{ label: '简体中文', code: 'zh' },
|
||
|
|
],
|
||
|
|
defaultLocale: 'en',
|
||
|
|
fallback: false,
|
||
|
|
},
|
||
|
|
secret: process.env.PAYLOAD_SECRET ?? 'change-me',
|
||
|
|
typescript: {
|
||
|
|
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
||
|
|
},
|
||
|
|
db: postgresAdapter({
|
||
|
|
pool: {
|
||
|
|
connectionString: process.env.DATABASE_URI ?? '',
|
||
|
|
},
|
||
|
|
push: true,
|
||
|
|
prodMigrations: undefined,
|
||
|
|
}),
|
||
|
|
upload: {
|
||
|
|
limits: {
|
||
|
|
fileSize: 500 * 1024 * 1024,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
sharp,
|
||
|
|
})
|