File size: 680 Bytes
529090e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Client } from 'minio';
import { getSecurityIntegrationConfig, isMinioConfigured } from '../../config/securityConfig.js';

let cachedMinio: Client | null = null;

export function getMinioClient(): Client | null {
  if (!isMinioConfigured()) {
    return null;
  }
  if (cachedMinio) {
    return cachedMinio;
  }

  const { minio } = getSecurityIntegrationConfig();
  cachedMinio = new Client({
    endPoint: minio.endpoint!,
    port: minio.port,
    useSSL: minio.useSSL,
    accessKey: minio.accessKey!,
    secretKey: minio.secretKey!,
  });

  return cachedMinio;
}

export function getMinioBucket(): string {
  return getSecurityIntegrationConfig().minio.bucket;
}