Skip to content

Commit a356949

Browse files
authored
[Feat] 사용자 정보 조회 로직 개선 (실제 데이터베이스 이용) (#22)
## 작업 내역 (관련 이슈) - #21 - UserService에서 Cognito 클라이언트를 초기화하는 방식을 개선하여, AWS 세션을 사용하도록 수정 - 사용자 풀 ID를 초기화 시점에 환경 변수에서 가져오도록 설정 ## 특이 사항 -
2 parents 2ce9953 + 55d38c1 commit a356949

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/users/service/UserService.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@
1515
class UserService:
1616
def __init__(self):
1717
self.user_repository = UserRepository()
18+
self.user_pool_id = os.environ.get('COGNITO_USER_POOL_ID', '')
1819
if os.environ.get('ENV') == 'local-profile':
19-
self.cognito_client = boto3.client(
20-
'cognito-idp',
21-
region_name=os.environ.get('AWS_REGION', 'ap-northeast-2'),
20+
session = boto3.Session(
2221
profile_name=os.environ.get('AWS_PROFILE', 'default')
2322
)
23+
self.cognito_client = session.client(
24+
'cognito-idp',
25+
region_name=os.environ.get('AWS_REGION', 'ap-northeast-2')
26+
)
2427
else:
2528
self.cognito_client = boto3.client(
2629
'cognito-idp',
2730
region_name=os.environ.get('AWS_REGION', 'ap-northeast-2')
2831
)
29-
self.user_pool_id = os.environ.get('COGNITO_USER_POOL_ID', '')
3032

3133
def get_wallets(self, user_id: str):
3234
wallets = self.user_repository.find_wallets_by_user_id(user_id)

0 commit comments

Comments
 (0)