로그 유저 아닐시 시스템으로 남기게 변경 히스토리 남기는 방식 추가 적용 HistoryRequest 생성 히스토리 API 작업 히스토리 mongodb 조회
40 lines
1.3 KiB
Java
40 lines
1.3 KiB
Java
package com.caliverse.admin.global.configuration;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
|
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
|
import software.amazon.awssdk.regions.Region;
|
|
import software.amazon.awssdk.services.s3.S3Client;
|
|
|
|
@Configuration
|
|
@RequiredArgsConstructor
|
|
public class S3Config {
|
|
@Value("${amazon.aws.accesskey}")
|
|
private String accessKey;
|
|
|
|
@Value("${amazon.aws.secretkey}")
|
|
private String secretKey;
|
|
|
|
@Value("${amazon.aws.region}")
|
|
private String region;
|
|
|
|
@Bean
|
|
@ConditionalOnProperty(name = "amazon.s3.enabled", havingValue = "true")
|
|
public S3Client s3Client() {
|
|
if(!accessKey.isEmpty()) {
|
|
AwsBasicCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey);
|
|
return S3Client.builder()
|
|
.credentialsProvider(StaticCredentialsProvider.create(credentials))
|
|
.region(Region.of(region))
|
|
.build();
|
|
}
|
|
return S3Client.builder()
|
|
.build();
|
|
}
|
|
}
|