package com.skr.mdm.config;

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

/**
 * @author nfq
 * @date 2023-03-06 9:41
 */
@Configuration
public class MinIoConfig {

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

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

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

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