buildbot-nix/buildbot_nix/secrets.py
magic_rb 1605d2d3c2 Remove assumption of GitHub being the only forge
Signed-off-by: magic_rb <richard@brezak.sk>
2024-04-29 18:29:35 +02:00

10 lines
312 B
Python

import os, sys
from pathlib import Path
def read_secret_file(secret_name: str) -> str:
directory = os.environ.get("CREDENTIALS_DIRECTORY")
if directory is None:
print("directory not set", file=sys.stderr)
sys.exit(1)
return Path(directory).joinpath(secret_name).read_text().rstrip()