#441 [Fix] 쿠팡 파트너스 ID 환경변수 누락 시 앱 부팅 실패 해소 - #448
Merged
Conversation
- application.yml 의 COUPANG_PARTNERS_ID 에 기본값을 준다. 기본값이 없어 환경변수가 없는 서버에서 PlaceholderResolutionException 이 나고, adminAdService 빈 생성 실패가 컨텍스트 전체를 무너뜨려 광고와 무관한 API 까지 502 로 내려갔다. - 빈 값이면 쿠팡 lptag 대조를 건너뛴다. AdminAdService 가 이미 그렇게 동작한다. - 광고 환경변수에 기본값이 있는지 검사하는 테스트를 추가한다. application-test.yml 이 값을 박아 둬서 컨텍스트 기동만으로는 재발을 못 잡는다. - 광고 API 스웨거 그룹 구성을 고정하는 테스트를 함께 추가한다.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
문제
dev 서버가 부팅 단계에서 죽어 502 → 무응답 상태입니다. 광고와 무관한 API까지 전부 내려갔습니다.
application.yml의COUPANG_PARTNERS_ID에만 기본값이 없어, 이 환경변수가 주입되지 않은 서버에서는 앱이 뜨지 못합니다.세 곳의 선언이 어긋나 있었습니다.
application.yml:165${COUPANG_PARTNERS_ID}— 기본값 없음 (필수)AdminAdService:41@Value("${coupang.partners.id:}")— 기본값 있음 (선택)코드는 "없어도 된다"고 선언했는데 설정 파일이 "반드시 있어야 한다"로 덮은 상태였습니다.
변경
application.yml의COUPANG_PARTNERS_ID에 빈 기본값을 준다. 나머지 광고 프로퍼티와AdminAdService의 선언에 맞춘다.AdminAdService:181이 이미 그렇게 동작하므로 동작 변경은 없다.CI 가 못 잡은 이유
deploy.yml은./gradlew build만 돌고, 그 빌드는application-test.yml이id: AF0000000을 박아 둔 test 프로파일로 동작합니다. 환경변수가 없는 경로를 한 번도 타지 않아 CI 통과가 부팅 성공을 보장하지 못했습니다.컨텍스트 기동만으로는 재발을 잡을 수 없어, 설정 파일의 플레이스홀더 자체를 검사하는 방식으로 테스트를 작성했습니다. 기본값을 되돌리면 실제로 실패하는 것을 확인했습니다.
검증
./gradlew test --tests "com.swyp.picke.domain.ad.*" --tests "...AdminAdServiceTest" --tests "com.swyp.picke.global.config.*" --rerun-tasks→ BUILD SUCCESSFUL${COUPANG_PARTNERS_ID:}→${COUPANG_PARTNERS_ID}로 되돌리면AdPropertyDefaultTestFAILED배포 전 필요한 조치
이 PR 은 환경변수가 없어도 앱이 뜨게 만들 뿐입니다. 값 자체는 별도로 주입해야 합니다.
주입하지 않으면 앱은 뜨지만 남의 파트너스 링크 등록 차단이 꺼진 채로 동작합니다. lptag 로 링크마다 노출되는 공개 식별자이므로 비밀값은 아닙니다.