package org.enfi.config.oss;

import org.enfi.common.util.oss.OssBootUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 云存储 配置
 */
@Configuration
public class OssConfiguration {

    @Value("${enfi.oss.endpoint}")
    private String endpoint;
    @Value("${enfi.oss.accessKey}")
    private String accessKeyId;
    @Value("${enfi.oss.secretKey}")
    private String accessKeySecret;
    @Value("${enfi.oss.bucketName}")
    private String bucketName;
    @Value("${enfi.oss.staticDomain:}")
    private String staticDomain;


    @Bean
    public void initOssBootConfiguration() {
        OssBootUtil.setEndPoint(endpoint);
        OssBootUtil.setAccessKeyId(accessKeyId);
        OssBootUtil.setAccessKeySecret(accessKeySecret);
        OssBootUtil.setBucketName(bucketName);
        OssBootUtil.setStaticDomain(staticDomain);
    }
}