buildbot-nix/buildbot_nix/secrets.py
magic_rb 6e8e735628 Utilize pydantic for serialization and deserialization
Signed-off-by: magic_rb <richard@brezak.sk>
2024-07-26 06:13:34 +00:00

12 lines
320 B
Python

import os
import sys
from pathlib import Path
def read_secret_file(secret_file: Path) -> 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_file).read_text().rstrip()