package com.starry.admin.common.oss;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Data
@Configuration
@ConfigurationProperties(prefix = "aliyun")
@PropertySource(value = {"classpath:oss.properties"})
public class OssProperties implements InitializingBean {

    public static String ENDPOINT = "";
    public static String KEY_ID = "";
    public static String KEY_SECRET = "";
    public static String BUCKET_NAME = "";
    public String endpoint = "oss-cn-hangzhou.aliyuncs.com";
    public String accessKeyId = "LTAI5t9ojt6uovFZokYZfJx5";
    public String accessKeySecret = "xfCyNM5BQlAkoaa5NbcpoeipmCKZgf";
    public String bucketName = "live-cloud-cvoon";

    @Override
    public void afterPropertiesSet() {
        ENDPOINT = getEndpoint();
        KEY_ID = getAccessKeyId();
        KEY_SECRET = getAccessKeySecret();
        BUCKET_NAME = getBucketName();
    }
}
