-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: 개발서버 테스트 환경 개선 #683
Open
fromitive
wants to merge
5
commits into
chongdae
Choose a base branch
from
feature/680-improve-test-environment
base: chongdae
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: 개발서버 테스트 환경 개선 #683
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
20c17be
chore: 테스트 Host 도메인 주소로 변환하여 추상화
fromitive 1822b81
refactor: 테스트 운영 환경 인증 클라이언트 분리
fromitive d3d71f2
refactor: 기존 운영환경과 동일한 인증 방식을 지원하고 인증이 실패해도 성공하도록 인증 방식 변경
fromitive f13af69
style: 컨벤션 적용
fromitive aee8382
refactor: 네이밍 리뷰 반영
fromitive File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
package com.zzang.chongdae.auth.config; | ||
|
||
import com.zzang.chongdae.auth.service.AuthClient; | ||
import com.zzang.chongdae.auth.service.TestAuthClient; | ||
import java.time.Duration; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.web.client.ClientHttpRequestFactories; | ||
import org.springframework.boot.web.client.ClientHttpRequestFactorySettings; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.http.client.ClientHttpRequestFactory; | ||
import org.springframework.web.client.RestClient; | ||
|
||
@Configuration | ||
@Slf4j | ||
public class AuthClientConfig { | ||
|
||
@Value("${auth.connect-timeout-length}") | ||
|
@@ -20,10 +24,18 @@ public class AuthClientConfig { | |
private Duration readTimeoutLength; | ||
|
||
@Bean | ||
public AuthClient authClient() { | ||
@Profile("prod") | ||
public AuthClient realAuthClient() { | ||
return new AuthClient(createRestClient()); | ||
} | ||
|
||
@Bean | ||
@Profile({"default", "dev"}) | ||
public AuthClient testAuthClient() { | ||
log.warn("테스트 인증 환경이 설정되었습니다. 프로덕션 환경이라면 서버 중지가 필요합니다."); | ||
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. 이렇게 로깅해주는 거 좋네요~! 👍 |
||
return new TestAuthClient(createRestClient()); | ||
} | ||
|
||
private RestClient createRestClient() { | ||
return RestClient.builder() | ||
.requestFactory(createRequestFactory()) | ||
|
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/com/zzang/chongdae/auth/service/TestAuthClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.zzang.chongdae.auth.service; | ||
|
||
import com.zzang.chongdae.global.exception.MarketException; | ||
import org.springframework.web.client.RestClient; | ||
|
||
public class TestAuthClient extends AuthClient { | ||
|
||
public TestAuthClient(RestClient restClient) { | ||
super(restClient); | ||
} | ||
|
||
@Override | ||
public String getKakaoUserInfo(String accessToken) { | ||
try { | ||
return super.getKakaoUserInfo(accessToken); | ||
} catch (MarketException e) { | ||
return accessToken; | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이런 네이밍은 어떨까요?
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.
Real, External, Prod, Oauth 고민하다가 prod 와 real이 남았서 고민했었는데 메이슨 덕분에 네이밍 고민이 줄어들었네요 ㅎㅎ
prod 프로파일과 동일한 명칭이면 사용할 때 햇갈리지 않을 것 같아요
그럼 testAuthClient도 일관성에 맞게 devAuthClient로 변경할까 고민이네요..
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.
일관성 있게 devAuthClient로 변경하는 것 찬성합니다! testAuthClient라는 명칭을 사용할 경우 dev 환경이 아닌 저희 로컬 테스트 환경으로 오해될 소지가 있는 것 같아요 :)
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.
오 답변을 못 드렸었네요! 죄송합니다. 저도 devAuthClient 좋은 것 같아요.
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.
오 그럼 devAuthClient, prodAuthClient 채택하겠습니다 의견 주셔서 고마워요 😄