fix: minio and main links

This commit is contained in:
Ivan Rezchikov
2026-07-12 16:47:49 +03:00
parent eaaf552ae6
commit 039cb4d2d3
4 changed files with 52 additions and 55 deletions
+5 -20
View File
@@ -1,32 +1,17 @@
import { Client } from "minio";
let _internalClient: Client | null = null;
let _publicClient: Client | null = null;
let _client: Client | null = null;
export function getMinioClient(): Client {
if (!_internalClient) {
_internalClient = new Client({
endPoint: process.env.MINIO_URL!,
port: Number(process.env.MINIO_PORT),
useSSL: false,
accessKey: process.env.MINIO_ACCESS_KEY!,
secretKey: process.env.MINIO_SECRET_KEY!,
});
}
return _internalClient;
}
export function getMinioPublicClient(): Client {
if (!_publicClient) {
if (!_client) {
const url = new URL(process.env.MINIO_PUBLIC_URL!);
_publicClient = new Client({
_client = new Client({
endPoint: url.hostname,
port: url.port ? Number(url.port) : (url.protocol === "https:" ? 443 : 80),
port: url.port ? Number(url.port) : 443,
useSSL: url.protocol === "https:",
accessKey: process.env.MINIO_ACCESS_KEY!,
secretKey: process.env.MINIO_SECRET_KEY!,
});
}
return _publicClient;
return _client;
}