2025-02-03 03:19:32 +07:00
|
|
|
// storage-adapter-import-placeholder
|
|
|
|
import { postgresAdapter } from "@payloadcms/db-postgres";
|
|
|
|
import { payloadCloudPlugin } from "@payloadcms/payload-cloud";
|
|
|
|
import { s3Storage } from "@payloadcms/storage-s3";
|
|
|
|
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 { Blogs } from "./collections/Blogs";
|
2025-02-04 03:05:23 +07:00
|
|
|
import { Interests } from "./collections/consultations/Interests";
|
|
|
|
import { ConsultationDateTime } from "./collections/consultations/consultation-datetime";
|
2025-02-03 03:19:32 +07:00
|
|
|
|
|
|
|
const filename = fileURLToPath(import.meta.url);
|
|
|
|
const dirname = path.dirname(filename);
|
|
|
|
|
|
|
|
export default buildConfig({
|
|
|
|
admin: {
|
|
|
|
user: Users.slug,
|
|
|
|
importMap: {
|
|
|
|
baseDir: path.resolve(dirname),
|
|
|
|
},
|
|
|
|
},
|
2025-02-04 03:05:23 +07:00
|
|
|
collections: [Users, Media, Blogs, Interests],
|
|
|
|
globals: [ConsultationDateTime],
|
2025-02-03 03:19:32 +07:00
|
|
|
secret: process.env.PAYLOAD_SECRET || "",
|
|
|
|
typescript: {
|
|
|
|
outputFile: path.resolve(dirname, "payload-types.ts"),
|
|
|
|
},
|
|
|
|
db: postgresAdapter({
|
|
|
|
pool: {
|
|
|
|
connectionString: process.env.DATABASE_URI || "",
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
sharp,
|
|
|
|
plugins: [
|
|
|
|
payloadCloudPlugin(),
|
|
|
|
// storage-adapter-placeholder
|
|
|
|
s3Storage({
|
|
|
|
collections: {
|
|
|
|
media: {
|
|
|
|
prefix: "media",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
bucket: process.env.S3_BUCKET || "",
|
|
|
|
config: {
|
|
|
|
forcePathStyle: true, // Important for using Supabase
|
|
|
|
credentials: {
|
|
|
|
accessKeyId: process.env.S3_ACCESS_KEY_ID || "",
|
|
|
|
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY || "",
|
|
|
|
},
|
|
|
|
region: process.env.S3_REGION,
|
|
|
|
endpoint: process.env.S3_ENDPOINT,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
});
|