Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlt8 committed Jul 18, 2024
1 parent 0afa612 commit a178f1c
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions app/wyzebridge/bridge_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,6 @@ def is_livestream(uri: str) -> bool:
return any(env_bool(f"{service}_{uri}") for service in services)


def get_secret(name: str) -> str:
if not name:
return ""
try:
with open(f"/run/secrets/{name.upper()}", "r") as f:
return f.read().strip("'\" \n\t\r")
except FileNotFoundError:
return env_bool(name, style="original")


def get_password(
file_name: str, alt: str = "", path: str = "", length: int = 16
) -> str:
if env_pass := (get_secret(file_name) or get_secret(alt)):
return env_pass

file_path = f"{path}{file_name}"
if os.path.exists(file_path) and os.path.getsize(file_path) > 0:
with open(file_path, "r") as file:
return file.read().strip()

password = secrets.token_urlsafe(length)
with open(file_path, "w") as file:
file.write(password)

print(f"\n\nDEFAULT {file_name.upper()}:\n{password=}")

return password


def migrate_path(old: str, new: str):
if not os.path.exists(old):
return
Expand Down

0 comments on commit a178f1c

Please sign in to comment.