feat: cli 세팅 및 깃허브 로그인 테스트 - #7
Conversation
| print("이미 로그아웃된 상태거나 삭제할 토큰이 없습니다.") | ||
|
|
||
|
|
||
| def send_to_aws(content): |
There was a problem hiding this comment.
| def send_to_aws(content): | |
| def save(content): |
가 어떨까.
aws 클로우드 서비스로 보낸다는 표현이 너무 과하게 특정된 느낌인거같음.
cli가 aws에 올라가있는 서버에 보낸다는것 까지 알아야하나
There was a problem hiding this comment.
넵! 이 부분에 대해서 수정해두겠습니다~
|
cli 프로그램도 헥사고날로 변경해봐. |
| self.token_storage = KeyringTokenAdapter() | ||
| self.memo_repo = HttpMemoRepositoryAdapter(api_base_url=settings.API_BASE_URL) | ||
| self.auth_repo = GitHubDeviceAuthAdapter( | ||
| client_id=settings.GITHUB_CLIENT_ID, | ||
| ) |
There was a problem hiding this comment.
container.memo_repo
라는 접근이 안되는게 좋을 듯
바로 service 객체에 넘겨줘도 될 거 같은데?
container에 저장하는 이유가 있음?
self.memo_service: MemoUseCase = MemoService(
memo_repo=HttpMemoRepositoryAdapter(api_base_url=settings.API_BASE_URL),
token_storage= KeyringTokenAdapter(),
)
이런식으로하면?
공부해볼 것: 맹글링
| self.GITHUB_CLIENT_ID = os.getenv("GITHUB_CLIENT_ID") | ||
|
|
||
| self.validate() |
There was a problem hiding this comment.
이거 변수 늘어날때마다 if + raise 문 계속 쓸거임?
개선해바
| self.token_storage = KeyringTokenAdapter() | ||
| self.memo_repo = HttpMemoRepositoryAdapter(api_base_url=settings.API_BASE_URL) |
There was a problem hiding this comment.
repo, storage
어떤 기준으로 네이밍 한거야?
|
|
||
| class KeyringTokenAdapter(TokenStoragePort): | ||
| def __init__( | ||
| self, service_name: str = "mylog-app", username: str = "user_secure_token" |
There was a problem hiding this comment.
| self, service_name: str = "mylog-app", username: str = "user_secure_token" |
상수로 박거나, 외부에서 주입만 받거나.
하는게 더 좋지 않을까?
상수로 박으면, 의미적으로
이 어떠한 경우에도 이 값이구나
인데
저렇게하면
일단 객체 생성하려면 service_name, username이 필요한데 없으면, 제공해주는 구나
라는 의미같음
| response.raise_for_status() | ||
| return response.json() | ||
|
|
||
| def poll_for_token(self, device_code: str, interval: int = 5) -> dict: |
There was a problem hiding this comment.
| def poll_for_token(self, device_code: str, interval: int = 5) -> dict: | |
| def poll_for_token(self, device_code: str, interval: int) -> dict: |
default value 왜케 좋아해 ..
There was a problem hiding this comment.
5에서 3으로 바꿔야하면 저 디폴트 값을 바꿔야할지?
실제로 저 메소드를 호출하는 곳에서 5를 넘겨주고 있는지?
착각하기 딱 좋음.
디폴트 밸류는 언제써야할까? 다 쓰면 좋은걸까?
고민해봐.
언제쓰는것이 적절한 케이스 인건지?
| } | ||
|
|
||
| while True: | ||
| time.sleep(interval) |
| table_name = os.getenv("DYNAMODB_TABLE") | ||
| if not table_name: | ||
| raise ValueError("DYNAMODB_TABLE 환경변수가 설정되지 않았습니다") | ||
| TOKEN_CACHE = cast(TTLCache[str, str, float], TTLCache(maxsize=100, ttl=300)) |
There was a problem hiding this comment.
| TOKEN_CACHE = cast(TTLCache[str, str, float], TTLCache(maxsize=100, ttl=300)) | |
| GITHUB_USER_ID_CACHE = cast(TTLCache[str, str, float], TTLCache(maxsize=100, ttl=300)) |
No description provided.