This commit is contained in:
Oliver Bryan
2026-01-01 06:56:35 +00:00
parent 44fe15cf9d
commit 54a32676b4
4 changed files with 240 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
import { S3Client } from "@aws-sdk/client-s3";
const s3Endpoint = process.env.S3_ENDPOINT;
const s3AccessKeyId = process.env.S3_ACCESS_KEY_ID;
const s3SecretAccessKey = process.env.S3_SECRET_ACCESS_KEY;
const s3BucketName = process.env.S3_BUCKET_NAME;
const s3PublicUrl = process.env.S3_PUBLIC_URL;
if (!s3Endpoint || !s3AccessKeyId || !s3SecretAccessKey || !s3BucketName) {
throw new Error("missing required S3 environment variables");
}
export const s3Client = new S3Client({
endpoint: s3Endpoint,
region: "auto",
credentials: {
accessKeyId: s3AccessKeyId,
secretAccessKey: s3SecretAccessKey,
},
});
export const bucketName = s3BucketName;
export { s3Endpoint, s3PublicUrl };