From 3f904b7a5c752b18098c7b21aa3758467ff4ef34 Mon Sep 17 00:00:00 2001 From: BlueBerrySoda Date: Wed, 22 May 2024 16:21:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#232-cloud=20front=20=EC=BA=90=EC=8B=B1?= =?UTF-8?q?=20=EC=A3=BC=EC=86=8C=EC=A0=80=EC=9E=A5=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/capstone/domain/qna/service/ImageService.java | 4 +++- back/src/main/resources/application.properties | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/back/src/main/java/com/example/capstone/domain/qna/service/ImageService.java b/back/src/main/java/com/example/capstone/domain/qna/service/ImageService.java index a14f0702d7..61f1be7925 100644 --- a/back/src/main/java/com/example/capstone/domain/qna/service/ImageService.java +++ b/back/src/main/java/com/example/capstone/domain/qna/service/ImageService.java @@ -36,6 +36,8 @@ public class ImageService { @Value("${s3.bucket.name}") private String bucketName; + @Value("${s3.cloud.front.url}") + private String cloudFront; private final QuestionImageRepository questionImageRepository; @@ -125,7 +127,7 @@ private String uploadImageToS3(MultipartFile image) throws IOException { is.close(); } - return amazonS3.getUrl(bucketName, s3FileName).toString(); + return "https://" + cloudFront + "/" + s3FileName; } public void deleteImageFromS3(String imageAddress) { diff --git a/back/src/main/resources/application.properties b/back/src/main/resources/application.properties index 0e40e12825..d81e905ce4 100644 --- a/back/src/main/resources/application.properties +++ b/back/src/main/resources/application.properties @@ -25,6 +25,7 @@ s3.secret.key=${S3_SECRET_KEY} s3.bucket.name=capstone-30-backend s3.region.static=ap-northeast-2 s3.stack.auto=false +s3.cloud.front.url=${CLOUD_FRONT_URL} spring.servlet.multipart.resolve-lazily=true spring.servlet.multipart.max-file-size=100MB