package org.jeecg.common.util.store.obs;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 云存储 配置
 * @author: jeecg-boot
 */
@Configuration
@ConditionalOnProperty(prefix = "jeecg.obs", name = "endpoint")
public class ObsConfiguration {

    @Value("${jeecg.obs.endpoint:}")
    private String endpoint;
    @Value("${jeecg.obs.ak:}")
    private String ak;
    @Value("${jeecg.obs.sk:}")
    private String sk;
    @Value("${jeecg.obs.bucketName:}")
    private String bucketName;
    @Value("${jeecg.obs.staticDomain:}")
    private String staticDomain;


    @Bean
    public void initObsStoreConfiguration() {
        ObsStoreUtil.setEndPoint(endpoint);
        ObsStoreUtil.setAk(ak);
        ObsStoreUtil.setSk(sk);
        ObsStoreUtil.setBucketName(bucketName);
        ObsStoreUtil.setStaticDomain(staticDomain);
    }
}
