Skip to content

Commit

Permalink
refactor [#27] S3 구성 파일 제거 및 핸들러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1hyun committed Jan 13, 2025
1 parent a0ca696 commit ea14a2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 49 deletions.
9 changes: 2 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'

// Logger
implementation 'ch.qos.logback:logback-classic:1.5.6'
implementation 'ch.qos.logback:logback-core:1.5.6'
implementation 'org.slf4j:slf4j-api:2.1.0-alpha1'

// AWS S3
implementation 'io.awspring.cloud:spring-cloud-aws-starter:3.1.1'
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.767'
implementation 'ch.qos.logback:logback-classic'
implementation 'org.slf4j:slf4j-api'

// actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'
Expand Down
33 changes: 0 additions & 33 deletions src/main/java/org/sopt/confeti/global/config/S3Config.java

This file was deleted.

13 changes: 4 additions & 9 deletions src/main/java/org/sopt/confeti/global/util/S3FileHandler.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package org.sopt.confeti.global.util;

import com.amazonaws.services.s3.AmazonS3Client;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class S3FileHandler {

private final AmazonS3Client amazonS3Client;
private S3FileHandler() {}

public S3FileHandler(AmazonS3Client amazonS3Client) {
this.amazonS3Client = amazonS3Client;
}

@Value("${cloud.aws.s3.bucket-name}")
private String bucket;
@Value("${cloud.aws.s3.url-prefix}")
private String urlPrefix;

public String getFileUrl(final String filePath) {
return amazonS3Client.getUrl(bucket, filePath).toString();
return urlPrefix + filePath;
}
}

0 comments on commit ea14a2f

Please sign in to comment.