15 lines
412 B
TypeScript
15 lines
412 B
TypeScript
import { Client, ClientOptions } from 'minio';
|
|
import { useConfig } from '@abearxiong/use-config';
|
|
|
|
type MinioConfig = {
|
|
minio: ClientOptions & { bucketName: string };
|
|
};
|
|
const config = useConfig<MinioConfig>();
|
|
|
|
const { bucketName, ...minioRest } = config.minio;
|
|
export const minioClient = new Client(minioRest);
|
|
export { bucketName };
|
|
if (!minioClient) {
|
|
throw new Error('Minio client not initialized');
|
|
}
|