-
Notifications
You must be signed in to change notification settings - Fork 2
prod : env 에 따른 cookie 분리 및 알림톡 전송 시 전화번호 정규화 오류 해결 #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a7d7e85
caa120d
1ef2cc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,23 @@ | ||
| package life.mosu.mosuserver; | ||
|
|
||
| import life.mosu.mosuserver.global.util.ProfileUtil; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.boot.CommandLineRunner; | ||
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
|
||
| @SpringBootApplication | ||
| public class MosuServerApplication { | ||
| @Slf4j | ||
| public class MosuServerApplication implements CommandLineRunner { | ||
|
|
||
| public static void main(String[] args) { | ||
| SpringApplication.run(MosuServerApplication.class, args); | ||
| } | ||
|
|
||
| @Override | ||
| public void run(String... args) throws Exception { | ||
| log.info("Active Profiles: {}", (Object) ProfileUtil.getActiveProfilesStatic()); | ||
| log.info("profile : {}", ProfileUtil.isProfileActiveStatic("prod")); | ||
| log.info("profile : {}", ProfileUtil.isProfileActiveStatic("test")); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,8 +64,10 @@ public static String createLocalCookieString(String name, String value, Long max | |
| */ | ||
| public static ResponseCookie createDevelopResponseCookie(String name, String value, | ||
| Long maxAge) { | ||
| boolean isProd = ProfileUtil.isProfileActiveStatic("prod"); | ||
|
|
||
| return createBaseResponseCookieBuilder(name, value, maxAge) | ||
| .secure(true) | ||
| .secure(isProd) | ||
| .domain(".mosuedu.com") | ||
| .sameSite("Strict") | ||
| .build(); | ||
|
Comment on lines
+67
to
73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 안녕하세요. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package life.mosu.mosuserver.global.util; | ||
|
|
||
| import org.springframework.beans.BeansException; | ||
| import org.springframework.context.ApplicationContext; | ||
| import org.springframework.context.ApplicationContextAware; | ||
| import org.springframework.core.env.Environment; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| public class ProfileUtil implements ApplicationContextAware { | ||
|
|
||
| private static Environment environment; | ||
|
|
||
| public static String[] getActiveProfilesStatic() { | ||
| return environment.getActiveProfiles(); | ||
| } | ||
|
|
||
| public static boolean isProfileActiveStatic(String profile) { | ||
| for (String active : environment.getActiveProfiles()) { | ||
| if (active.equals(profile)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
Comment on lines
+18
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| @Override | ||
| public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
| environment = applicationContext.getEnvironment(); | ||
| } | ||
| } | ||
|
Comment on lines
+10
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
더 나은 대안으로, 물론 현재 구조에서 |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요. 애플리케이션 시작 시 활성 프로필을 확인하기 위한 로그를 추가하신 것으로 보입니다. 이 로그는 개발 및 디버깅 과정에서는 유용하지만, 프로덕션 환경에서는 불필요한 정보가 될 수 있습니다.
log.debug레벨로 변경하여 개발 환경에서만 확인하고 프로덕션 로그에서는 제외하는 것을 권장합니다.