Skip to content

Commit

Permalink
♻️ [STMT-179] 이미지 유효 시간을 환경변수로 관리하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
zxcv9203 committed May 4, 2024
1 parent 0ad4c59 commit 2794098
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class S3ImageStorageAdapter implements FileCommandPort, PresignedUrlGener
private String bucket;
@Value("${spring.cloud.config.server.awss3.endpoint}")
private String endpoint;
@Value("${presigned.url.expired-time}")
private int expiredTime;

@Override
public FileUrl uploadImageFile(MultipartFile file, String directoryPath) {
Expand Down Expand Up @@ -106,7 +108,7 @@ public FileUrl generatePresignedUrl(FileManagementPath path, String fileName) {
String key = FileUtil.generateKey(path.getPath(), fileName);

PresignedPutObjectRequest request = s3Presigner.presignPutObject(p ->
p.signatureDuration(Duration.ofMinutes(60))
p.signatureDuration(Duration.ofSeconds(expiredTime))
.putObjectRequest(pr -> pr.bucket(bucket).key(key))
);

Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ oauth:
apple:
url: https://appleid.apple.com
kakao:
url: https://kapi.kakao.com
url: https://kapi.kakao.com

presigned:
url:
expired-time: 3600
6 changes: 5 additions & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ oauth:
apple:
url: https://appleid.apple.com
kakao:
url: https://kapi.kakao.com
url: https://kapi.kakao.com

presigned:
url:
expired-time: 3600
6 changes: 5 additions & 1 deletion src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ oauth:
apple:
url: http://localhost:8089
kakao:
url: http://localhost:8089
url: http://localhost:8089

presigned:
url:
expired-time: 3600

0 comments on commit 2794098

Please sign in to comment.