2024-04-27 15:06:17 +00:00
|
|
|
import os
|
|
|
|
import sys
|
2024-04-22 13:58:38 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
2024-04-27 15:06:17 +00:00
|
|
|
|
2024-07-19 20:20:42 +00:00
|
|
|
def read_secret_file(secret_file: Path) -> str:
|
2024-04-22 13:58:38 +00:00
|
|
|
directory = os.environ.get("CREDENTIALS_DIRECTORY")
|
|
|
|
if directory is None:
|
|
|
|
print("directory not set", file=sys.stderr)
|
|
|
|
sys.exit(1)
|
2024-07-19 20:20:42 +00:00
|
|
|
return Path(directory).joinpath(secret_file).read_text().rstrip()
|