mirror of
https://github.com/soconnor0919/hristudio.git
synced 2026-03-23 19:27:51 -04:00
21 lines
573 B
TypeScript
21 lines
573 B
TypeScript
import { S3Client } from "@aws-sdk/client-s3";
|
|
import { env } from "~/env";
|
|
|
|
const globalForS3 = globalThis as unknown as {
|
|
s3Client: S3Client | undefined;
|
|
};
|
|
|
|
export const s3Client =
|
|
globalForS3.s3Client ??
|
|
new S3Client({
|
|
region: env.MINIO_REGION ?? "us-east-1",
|
|
endpoint: env.MINIO_ENDPOINT,
|
|
credentials: {
|
|
accessKeyId: env.MINIO_ACCESS_KEY ?? "minioadmin",
|
|
secretAccessKey: env.MINIO_SECRET_KEY ?? "minioadmin",
|
|
},
|
|
forcePathStyle: true, // Needed for MinIO
|
|
});
|
|
|
|
if (env.NODE_ENV !== "production") globalForS3.s3Client = s3Client;
|