diff --git a/src/main/java/com/flab/shoeauction/common/properties/AwsProperties.java b/src/main/java/com/flab/shoeauction/common/properties/AwsProperties.java index 5c7c4bbd..2c9ca787 100644 --- a/src/main/java/com/flab/shoeauction/common/properties/AwsProperties.java +++ b/src/main/java/com/flab/shoeauction/common/properties/AwsProperties.java @@ -47,7 +47,7 @@ public String getSecretKey() { return credentials.getSecretKey(); } - public String getBrnadBucket() { + public String getBrandBucket() { return s3.getBrand(); } diff --git a/src/main/java/com/flab/shoeauction/controller/common/ProfileController.java b/src/main/java/com/flab/shoeauction/controller/common/ProfileController.java new file mode 100644 index 00000000..91a4027e --- /dev/null +++ b/src/main/java/com/flab/shoeauction/controller/common/ProfileController.java @@ -0,0 +1,27 @@ +package com.flab.shoeauction.controller.common; + +import edu.emory.mathcs.backport.java.util.Arrays; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.core.env.Environment; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RequiredArgsConstructor +@RestController +public class ProfileController { + + private final Environment env; + + @GetMapping("/profile") + public String profile() { + List profiles = Arrays.asList(env.getActiveProfiles()); + List realProfiles = Arrays.asList(new String[]{"real", "real1", "real2"}); + String defaultProfile = profiles.isEmpty() ? "default" : profiles.get(0); + + return profiles.stream() + .filter(realProfiles::contains) + .findAny() + .orElse(defaultProfile); + } +} diff --git a/src/main/java/com/flab/shoeauction/service/storage/AwsS3Service.java b/src/main/java/com/flab/shoeauction/service/storage/AwsS3Service.java index de5b27e7..e6ea39fc 100644 --- a/src/main/java/com/flab/shoeauction/service/storage/AwsS3Service.java +++ b/src/main/java/com/flab/shoeauction/service/storage/AwsS3Service.java @@ -44,7 +44,7 @@ private void setS3Client() { } public String uploadBrandImage(MultipartFile file) { - return upload(file, awsProperties.getBrnadBucket()); + return upload(file, awsProperties.getBrandBucket()); } public String uploadProductImage(MultipartFile file) { @@ -72,7 +72,7 @@ public String upload(MultipartFile file, String bucket) { } public void deleteBrandImage(String key) { - delete(awsProperties.getBrnadBucket(), key); + delete(awsProperties.getBrandBucket(), key); } public void deleteProductImage(String key) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d37bd452..b1631445 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,12 +1,10 @@ # profile을 타지않는 전역 설정 -# format_sql : query의 출력 내용을 서식에 맞게 가독성을 향상시켜 출 - +# format_sql : query의 출력 내용을 서식에 맞게 가독성을 향상시켜 출력 spring: profiles: active: dev - jpa: properties: hibernate: - format_sql: true + format_sql: true \ No newline at end of file