From 323f2530c7c92b8e9a7c3ed60fa20faf5342820b Mon Sep 17 00:00:00 2001 From: seungheonlee Date: Tue, 15 Jul 2025 13:36:17 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20UnindentedException=20->=20Unde?= =?UTF-8?q?finedException=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nLoggingAspect.java => UndefinedExceptionLoggingAspect.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/main/java/com/pitchain/common/aspect/{UnintendedExceptionLoggingAspect.java => UndefinedExceptionLoggingAspect.java} (98%) diff --git a/src/main/java/com/pitchain/common/aspect/UnintendedExceptionLoggingAspect.java b/src/main/java/com/pitchain/common/aspect/UndefinedExceptionLoggingAspect.java similarity index 98% rename from src/main/java/com/pitchain/common/aspect/UnintendedExceptionLoggingAspect.java rename to src/main/java/com/pitchain/common/aspect/UndefinedExceptionLoggingAspect.java index 2c9b7d5..15cb9ef 100644 --- a/src/main/java/com/pitchain/common/aspect/UnintendedExceptionLoggingAspect.java +++ b/src/main/java/com/pitchain/common/aspect/UndefinedExceptionLoggingAspect.java @@ -25,7 +25,7 @@ @Aspect @RequiredArgsConstructor @Component -public class UnintendedExceptionLoggingAspect { +public class UndefinedExceptionLoggingAspect { private final DiscordWebhookSender discordWebhookSender; From 88b4307571328d62845c892a9d0ca740c3930ca2 Mon Sep 17 00:00:00 2001 From: seungheonlee Date: Tue, 15 Jul 2025 13:36:59 +0900 Subject: [PATCH 2/5] =?UTF-8?q?refactor:=20=EB=A1=9C=EA=B7=B8=20=ED=98=95?= =?UTF-8?q?=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pitchain/common/aspect/GeneralExceptionLoggingAspect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/pitchain/common/aspect/GeneralExceptionLoggingAspect.java b/src/main/java/com/pitchain/common/aspect/GeneralExceptionLoggingAspect.java index bc7c137..2baddd9 100644 --- a/src/main/java/com/pitchain/common/aspect/GeneralExceptionLoggingAspect.java +++ b/src/main/java/com/pitchain/common/aspect/GeneralExceptionLoggingAspect.java @@ -35,7 +35,7 @@ public void logAfterThrowing(JoinPoint joinPoint, GeneralException exception) { ErrorStatus errorStatus = exception.getErrorStatus(); MDC.put("httpStatus", String.valueOf(errorStatus.getHttpStatus())); - log.error("[ERROR] POINT : {} || EXCEPTION : {} || ARGUMENTS : {}", + log.error("[ERROR] POINT : {} || ERROR CODE : {} || ARGUMENTS : {}", className, errorStatus.getCode(), parameterMessage ); log.error("[ERROR] FINAL POINT : {}", exception.getStackTrace()[0]); From bc154199f46196d7de9ee271668da432ca3e4a3a Mon Sep 17 00:00:00 2001 From: seungheonlee Date: Tue, 15 Jul 2025 13:40:50 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20CORS=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EC=9D=84=20=EC=99=B8=EB=B6=80=20=ED=94=84=EB=A1=9C=ED=8D=BC?= =?UTF-8?q?=ED=8B=B0=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/pitchain/common/config/SecurityConfig.java | 6 +++++- src/main/resources/application.yml | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/pitchain/common/config/SecurityConfig.java b/src/main/java/com/pitchain/common/config/SecurityConfig.java index d5401cc..91d27a4 100644 --- a/src/main/java/com/pitchain/common/config/SecurityConfig.java +++ b/src/main/java/com/pitchain/common/config/SecurityConfig.java @@ -7,6 +7,7 @@ import com.pitchain.common.filter.JwtAuthenticationFilter; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -36,6 +37,9 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final RoleRequestCollector roleRequestCollector; + @Value("#{'${spring.cors.allowed-origins}'.replaceAll(' ', '').split(',')}") + private List allowedOrigins; + @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); @@ -92,7 +96,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); - config.setAllowedOrigins(List.of("http://localhost:5173")); + config.setAllowedOrigins(allowedOrigins); config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")); config.setAllowedHeaders(List.of("*")); config.setExposedHeaders(Arrays.asList("Authorization", "Authorization-Refresh")); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5b9adf5..5e8a810 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -9,6 +9,8 @@ spring: fallback-to-system-locale: false encoding: UTF-8 cache-duration: 3600 + cors: + allowed-origins: ${CORS_ALLOWED_ORIGINS} datasource: master: driver-class-name: ${MASTER_DATASOURCE_DRIVER_CLASS_NAME} @@ -28,7 +30,6 @@ spring: host: ${REDIS_HOST} port: ${REDIS_PORT} channel: ${REDIS_CHANNEL} - cloud: aws: s3: From 290d09f9ae5f423d7648f6cbba9a0136a60dcfa9 Mon Sep 17 00:00:00 2001 From: seungheonlee Date: Tue, 15 Jul 2025 13:47:28 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20=EB=A9=94=EC=86=8C=EB=93=9C=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/config/SecurityConfig.java | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/pitchain/common/config/SecurityConfig.java b/src/main/java/com/pitchain/common/config/SecurityConfig.java index 91d27a4..f993746 100644 --- a/src/main/java/com/pitchain/common/config/SecurityConfig.java +++ b/src/main/java/com/pitchain/common/config/SecurityConfig.java @@ -40,10 +40,25 @@ public class SecurityConfig { @Value("#{'${spring.cors.allowed-origins}'.replaceAll(' ', '').split(',')}") private List allowedOrigins; - @Bean - public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } + private static final String[] SWAGGER_PATTERNS = { + "/swagger-ui/**", + "/v3/api-docs/**", + }; + + private static final String[] STATIC_RESOURCES_PATTERNS = { + "/img/**", + "/css/**", + "/js/**", + "/favicon.ico", + }; + + private static final String[] PUBLIC_ENDPOINTS = { + "/health-check", // health check + "/oauth**", + "/members/tokens", "/members/emails", // 공통 유저 + "/companies", "/companies/login", // 회사 + "/dev/**", // 개발용 + }; @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { @@ -72,26 +87,6 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { return http.build(); } - private static final String[] SWAGGER_PATTERNS = { - "/swagger-ui/**", - "/v3/api-docs/**", - }; - - private static final String[] STATIC_RESOURCES_PATTERNS = { - "/img/**", - "/css/**", - "/js/**", - "/favicon.ico", - }; - - private static final String[] PUBLIC_ENDPOINTS = { - "/health-check", // health check - "/oauth**", - "/members/tokens", "/members/emails", // 공통 유저 - "/companies", "/companies/login", // 회사 - "/dev/**", // 개발용 - }; - @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration config = new CorsConfiguration(); @@ -131,4 +126,9 @@ private static void writeErrorResponse(HttpServletResponse response, String mess response.setCharacterEncoding("UTF-8"); response.getWriter().write(new ObjectMapper().writeValueAsString(customResponse)); } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } } From 1f2c64c89826fcf1c14256c6d3fb9702efdfbe81 Mon Sep 17 00:00:00 2001 From: seungheonlee Date: Tue, 15 Jul 2025 13:47:45 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor:=20jar=20=EC=8B=A4=ED=96=89=20?= =?UTF-8?q?=EC=8B=9C=20prod=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 72d52de..7aa4c32 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -29,6 +29,6 @@ TIME_NOW=$(date +%c) echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE -# jar 파일 실행 +# jar 파일 실행 (prod 프로필 적용) echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG -nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG & \ No newline at end of file +nohup java -jar $JAR_FILE --spring.profiles.active=prod > $APP_LOG 2> $ERROR_LOG &