package com.nailart.config;


import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Description MinIO配置类，用于创建MinIO客户端实例
 * @Classname MinioConfig
 * @Date 2025/7/16 10:13
 * @Created by 21616
 */
@Configuration
public class MinioConfig {

    @Value("${minio.endpoint}")
    private String endpoint;

    @Value("${minio.accessKey}")
    private String accessKey;

    @Value("${minio.secretKey}")
    private String secretKey;

    @Value("${minio.region:}")
    private String region;

    @Value("${minio.connectTimeout:30}")
    private long connectTimeout;

    @Value("${minio.writeTimeout:60}")
    private long writeTimeout;

    @Value("${minio.readTimeout:60}")
    private long readTimeout;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
}