Skip to content

Commit

Permalink
Merge pull request #26 from a-luna:fix-gh-action-deploy_attempt-12
Browse files Browse the repository at this point in the history
Refactor RedisClient password_discreet property
  • Loading branch information
a-luna authored Jan 8, 2024
2 parents 564f2f2 + 96190a7 commit 30ed7cd
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions app/core/redis_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,10 @@ def __init__(self):

self.logger.info(f"Redis URL: {self.redis_url}")

@property
def password_discreet(self) -> str:
if not self.redis_pw:
return ""
return (
f'{"*" * len(self.redis_pw[:-4])}{self.redis_pw[-4:]}'
if len(self.redis_pw) > 4
else "*" * len(self.redis_pw)
)

@property
def redis_url(self) -> str:
return (
f"redis://:{self.password_discreet}@{self.redis_host}:{self.redis_host_port}/{self.redis_db}"
f"redis://:{self.redis_pw}@{self.redis_host}:{self.redis_host_port}/{self.redis_db}"
if self.redis_pw
else f"redis://{self.redis_host}:{self.redis_host_port}/{self.redis_db}"
)
Expand Down

0 comments on commit 30ed7cd

Please sign in to comment.