package com.ho.business.common;

import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @Author yule
 * @Date 2023/05/05 11:03
 */
@Slf4j
//@Configuration
public class MinioClientConfigBakk {

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

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

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



    /**
     * 初始化minio配置
     *
     * @param :
     * @return: void
     * @date : 2020/8/16 20:56
     */
    @Bean
    public  MinioClient minioClient(){
        MinioClient minioClient = null;
        try {
            minioClient = MinioClient.builder()
                    .endpoint(url)
                    .credentials(accessKey,secretKey)
                    .build();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("初始化minio配置异常: 【{}】", e.fillInStackTrace());
        }
        return minioClient;
    }

 
}
