11 lines
317 B
Python
11 lines
317 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
|
|
def secret(name: str) -> str:
|
|
filename = os.environ.get(name + "_FILE")
|
|
value = Path(filename).read_text().strip() if filename else os.environ.get(name, "")
|
|
if not value:
|
|
raise RuntimeError("Отсутствует настройка " + name)
|
|
return value
|