Skip to content

Commit

Permalink
feat: #232-cloud front 캐싱 주소저장 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueBerrySoda committed May 22, 2024
1 parent 82e9257 commit 3f904b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions back/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3f904b7

Please sign in to comment.