import { postgresAdapter } from '@payloadcms/db-postgres';
import { lexicalEditor } from '@payloadcms/richtext-lexical';
import { buildConfig } from 'payload';
import sharp from 'sharp';

import { env } from './env';
import { Users } from './payload/collections/users';
import { LandingPage } from './payload/globals/landing-page';

export default buildConfig({
  serverURL: env.NEXT_PUBLIC_SITE_URL,
  editor: lexicalEditor(),
  collections: [Users],
  globals: [LandingPage],
  secret: env.PAYLOAD_SECRET,
  db: postgresAdapter({
    pool: {
      connectionString: env.PAYLOAD_DB_URL,
    },
  }),
  sharp,
});
