18 lines
785 B
TypeScript
18 lines
785 B
TypeScript
import { S3Client } from "@aws-sdk/client-s3";
|
|
|
|
// We use AWS SDK because it works interchangeably with MinIO, GCS HMAC, and actual AWS S3.
|
|
// If the user spins up a MinIO service on Coolify later, they literally just change the ENDPOINT URL.
|
|
|
|
const s3Client = new S3Client({
|
|
region: process.env.STORAGE_REGION || "northamerica-northeast1",
|
|
endpoint: process.env.STORAGE_ENDPOINT || "https://storage.googleapis.com", // Works for GCS or MinIO
|
|
forcePathStyle: process.env.STORAGE_FORCE_PATH_STYLE === "true", // Required for MinIO
|
|
credentials: {
|
|
accessKeyId: process.env.STORAGE_ACCESS_KEY_ID || "",
|
|
secretAccessKey: process.env.STORAGE_SECRET_ACCESS_KEY || "",
|
|
},
|
|
});
|
|
|
|
export const BUCKET_NAME = process.env.STORAGE_BUCKET || "vibn-uploads";
|
|
export default s3Client;
|