use script-dependencies.nix as a nix shell environment instead of specifying dependencies in shebangs of each individual script file

This commit is contained in:
cswimr 2024-11-25 14:21:02 -05:00
parent d82fe7048a
commit ef297345e1
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
4 changed files with 22 additions and 7 deletions

View file

@ -30,10 +30,10 @@ def notify(
def read_secret_file(secret: str) -> str:
path = f"/run/secrets/{secret}"
path = f"/var/secrets/{secret}"
if not os.path.exists(path):
raise FileNotFoundError(f"Secret file {path} does not exist.")
with open(f"/run/secrets/{secret}", "r") as f:
raise FileNotFoundError(f"Secret file {path} does not exist or cannot be read.")
with open(f"/var/secrets/{secret}", "r") as f:
secret = f.read().strip()
if not secret:
raise ValueError(f"Secret file {path} is empty.")