Fixed issue with bytes when saving credentials
This commit is contained in:
parent
68f05a0c0c
commit
d79a01cfb1
2 changed files with 3 additions and 3 deletions
|
@ -24,7 +24,7 @@ def put(key: str, value: str, encoded=False):
|
|||
fileexists()
|
||||
with open(_file, "r+", encoding="utf-8") as file:
|
||||
content: dict[str, str] = yaml.load(file, Loader=yaml.SafeLoader) or {}
|
||||
content.update({ key: str(base64.b64encode(value.encode())) if encoded else value })
|
||||
content.update({ key: str(base64.b64encode(value.encode()), "utf-8") if encoded else value })
|
||||
with open(_file, "w+", encoding="utf-8") as file:
|
||||
yaml.dump(content, file, Dumper=yaml.SafeDumper)
|
||||
|
||||
|
@ -52,7 +52,7 @@ def get(key: str, encoded=False):
|
|||
value = content.get(key, None)
|
||||
if value is None:
|
||||
return None
|
||||
return base64.b64decode(value).decode() if encoded else value
|
||||
return base64.b64decode(value.encode()).decode() if encoded else value
|
||||
|
||||
def clear():
|
||||
"""
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "dockge_cli"
|
||||
version = "0.1.0-c.1"
|
||||
version = "0.1.0-c.2"
|
||||
dependencies = [
|
||||
"pyyaml~=6.0.1",
|
||||
"pydantic~=2.8.0",
|
||||
|
|
Loading…
Reference in a new issue