package com.sqx.config;

import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * minio客户端自动注入
 *
 * @author : codingliang
 * @date : 2024-09-29 18:35
 */
@Configuration
@RequiredArgsConstructor
public class MinioClientConfig {
    private final MinioConfig minioConfig;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioConfig.getEndpoint())
                .credentials(minioConfig.getAccessKey(), minioConfig.getSecretKey())
                .build();
    }
}
