Skip to content
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

refresh token을 redis에 저장한다. #515

Merged
merged 9 commits into from
Dec 7, 2023
Merged

refresh token을 redis에 저장한다. #515

merged 9 commits into from
Dec 7, 2023

Conversation

lsh23
Copy link
Collaborator

@lsh23 lsh23 commented Dec 7, 2023

PR 요약

  • refresh token을 redis에 저장한다.
  • nestjs cache 모듈 도입, 이에 따른 환경변수 추가
  • auth controller 테스트 추가

변경 사항

  • 승환님 개발 환경에 따로 설정 필요 없이 NODE_ENV가 production일 때만 redis store를 사용하고, 아니면 in memory 사용하도록 설정해두었습니다.
  • 관련 환경 변수 추가
    • REDIS_PORT
    • REDIS_HOST
    • CACHE_TTL
스크린샷

image

image

Linked Issue

close #514

@lsh23 lsh23 added BE BE 관련사항 feature 기능 추가 메인 메인 기능 labels Dec 7, 2023
@lsh23 lsh23 added this to the week1 milestone Dec 7, 2023
@lsh23 lsh23 self-assigned this Dec 7, 2023
@lsh23 lsh23 requested a review from Dltmd202 December 7, 2023 14:15
Comment on lines +66 to +70
CACHE_TTL: Joi.number().when('NODE_ENV', {
is: 'production',
then: Joi.required(),
otherwise: Joi.optional(),
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하! ㅠㅠ 이 부분 아쉬우시겠네요...
일단 저는 이것도 좋습니다!

Comment on lines +8 to +17
useFactory: async (configService: ConfigService) => {
return configService.get('NODE_ENV') === 'production'
? {
store: redisStore,
host: configService.get('REDIS_HOST'),
port: configService.get('REDIS_PORT'),
ttl: configService.get('CACHE_TTL'),
}
: { store: memoryStore };
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하! 추상화 잘 해주신거 너무 좋네요!

@lsh23 lsh23 merged commit 392dbbb into develop Dec 7, 2023
1 check passed
@Dltmd202 Dltmd202 deleted the BE/feature/#514 branch December 7, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE BE 관련사항 feature 기능 추가 메인 메인 기능
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refresh token을 redis에 저장한다.
2 participants