Files
eu/lib/minio.ts
T

17 lines
458 B
TypeScript

import { Client } from "minio";
let _client: Client | null = null;
export function getMinioClient(): Client {
if (!_client) {
const url = new URL(process.env.MINIO_PUBLIC_URL!);
_client = new Client({
endPoint: url.hostname,
port: url.port ? Number(url.port) : 443,
useSSL: url.protocol === "https:",
accessKey: process.env.MINIO_ACCESS_KEY!,
secretKey: process.env.MINIO_SECRET_KEY!,
});
}
return _client;
}