package com.xingxi.common.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSBuilder;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AliyunOSSConfig {

    @Value("${aliyun.oss.endPoint}")
    private String endPoint;

    @Value("${aliyun.oss.accessKeyID}")
    private String accessKeyID;

    @Value("${aliyun.oss.accessKeySecret}")
    private String accessKeySecret;

    @Value("${aliyun.oss.bucketName}")
    private String bucketName;

    @Value("${aliyun.oss.customDomain}")
    private String customDomain;

    @Bean
    public OSS ossClient(){
        OSSBuilder builder = new OSSClientBuilder();
        return builder.build(endPoint, accessKeyID, accessKeySecret);
    }
}
