From 8e7b389b0625e1f54479687ffa709b70b0de8298 Mon Sep 17 00:00:00 2001 From: 0chil <0@chll.it> Date: Sun, 3 Nov 2024 16:31:13 +0900 Subject: [PATCH] =?UTF-8?q?chore(s3):=20CloudFront=EC=97=90=20=EC=BA=90?= =?UTF-8?q?=EC=8B=B1=EB=90=9C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/snackgame/server/common/file/S3FileUploader.kt | 4 +++- .../java/com/snackgame/server/member/domain/ProfileImage.java | 2 +- .../server/member/service/dto/MemberDetailsResponse.kt | 2 +- .../server/rank/controller/dto/RankOwnerResponse.java | 2 +- src/main/resources/secrets | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/snackgame/server/common/file/S3FileUploader.kt b/src/main/java/com/snackgame/server/common/file/S3FileUploader.kt index 2e79f626..82431dbe 100644 --- a/src/main/java/com/snackgame/server/common/file/S3FileUploader.kt +++ b/src/main/java/com/snackgame/server/common/file/S3FileUploader.kt @@ -14,6 +14,8 @@ import java.util.stream.Collectors class S3FileUploader( @Value("\${cloud.aws.s3.bucket}") private val bucket: String, + @Value("\${cloud.aws.cloudfront.domain}") + private val cloudFrontDomain: String, private val amazonS3Client: AmazonS3 ) { @@ -35,7 +37,7 @@ class S3FileUploader( it } amazonS3Client.putObject(bucket, key, resource.inputStream, metadata) - return amazonS3Client.getUrl(bucket, key) + return URL("https://$cloudFrontDomain/$key") } private fun uniquePathOf(resource: Resource): String { diff --git a/src/main/java/com/snackgame/server/member/domain/ProfileImage.java b/src/main/java/com/snackgame/server/member/domain/ProfileImage.java index 2f11ef10..96c03764 100644 --- a/src/main/java/com/snackgame/server/member/domain/ProfileImage.java +++ b/src/main/java/com/snackgame/server/member/domain/ProfileImage.java @@ -18,7 +18,7 @@ public class ProfileImage { private static final int MAXIMUM_URL_LENGTH = 255; public static final ProfileImage EMPTY = new ProfileImage( - "https://snackgame.s3.ap-northeast-2.amazonaws.com/static/logo.png"); + "https://d104q5gjwhhnfk.cloudfront.net/static/logo.png"); @Column(name = "profile_image", nullable = false) private String url; diff --git a/src/main/java/com/snackgame/server/member/service/dto/MemberDetailsResponse.kt b/src/main/java/com/snackgame/server/member/service/dto/MemberDetailsResponse.kt index d2c88642..fb51afe9 100644 --- a/src/main/java/com/snackgame/server/member/service/dto/MemberDetailsResponse.kt +++ b/src/main/java/com/snackgame/server/member/service/dto/MemberDetailsResponse.kt @@ -12,7 +12,7 @@ class MemberDetailsResponse( @field:Schema(example = "닉네임") val name: String, val group: GroupResponse?, - @field:Schema(example = "https://snackgame.s3.ap-northeast-2.amazonaws.com/unhashed/7d9b26272791438b8dc6893a4cbd6f50-77423374") + @field:Schema(example = "https://d104q5gjwhhnfk.cloudfront.net/unhashed/7d9b26272791438b8dc6893a4cbd6f50-77423374") val profileImage: String, val status: StatusResponse, @field:Schema(example = "SOCIAL", allowableValues = ["SELF", "GUEST", "SOCIAL"]) diff --git a/src/main/java/com/snackgame/server/rank/controller/dto/RankOwnerResponse.java b/src/main/java/com/snackgame/server/rank/controller/dto/RankOwnerResponse.java index 065b19e8..11eabd14 100644 --- a/src/main/java/com/snackgame/server/rank/controller/dto/RankOwnerResponse.java +++ b/src/main/java/com/snackgame/server/rank/controller/dto/RankOwnerResponse.java @@ -14,7 +14,7 @@ public class RankOwnerResponse { private final Long id; @Schema(example = "보리") private final String name; - @Schema(example = "https://snackgame.s3.ap-northeast-2.amazonaws.com/unhashed/7d9b26272791438b8dc6893a4cbd6f50-77423374") + @Schema(example = "https://d104q5gjwhhnfk.cloudfront.net/unhashed/7d9b26272791438b8dc6893a4cbd6f50-77423374") private final String profileImage; private final StatusResponse status; private final GroupResponse group; diff --git a/src/main/resources/secrets b/src/main/resources/secrets index e7108e1e..83e2ee42 160000 --- a/src/main/resources/secrets +++ b/src/main/resources/secrets @@ -1 +1 @@ -Subproject commit e7108e1e8e98d218f0619de9e71033f90fedf4e6 +Subproject commit 83e2ee4208d65ae159704fa15bb7062843bd7c9a