Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from bemble/fix_no_aria2_secret
Browse files Browse the repository at this point in the history
fix(config): fix dump secret when optional (None)
  • Loading branch information
bemble authored May 12, 2024
2 parents a6d7291 + fe68915 commit e5e37f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/holerr/core/config_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def update(self, data: dict):
setattr(self, k, v)

def _dump_secret(self, v, info):
if v is None:
return None
value = v.get_secret_value()
if info.mode == "python":
if info.mode == "python" or value is None:
return value
return secrets.hide(value)

Expand Down Expand Up @@ -96,7 +98,7 @@ def dump_secret(self, v, info):

class Aria2JsonRpc(Model):
endpoint: str
secret: Optional[SecretStr]
secret: Optional[SecretStr] = None

@field_serializer("secret")
def dump_secret(self, v, info):
Expand Down

0 comments on commit e5e37f1

Please sign in to comment.