подгрузка данных для api из env

This commit is contained in:
2026-08-19 16:28:09 +03:00
parent bddc0967b3
commit c643a183d8
15 changed files with 891 additions and 86 deletions

View File

@@ -382,12 +382,22 @@ class HockeySettingsStore:
password = os.getenv("STAT2TV_PASSWORD", str(raw.get("password") or ""))
return username.strip(), password
def credentials_source(self) -> str:
"""Return where Stat2TV credentials come from without exposing secrets."""
if os.getenv("STAT2TV_LOGIN") is not None or os.getenv("STAT2TV_PASSWORD") is not None:
return "env"
raw = self._read_json(self.secret_file)
if str(raw.get("username") or "").strip() or str(raw.get("password") or ""):
return "local_file"
return "missing"
def status(self) -> dict[str, Any]:
settings = self.public()
username, password = self.credentials()
return {
**settings,
"credentials_configured": bool(username and password),
"credentials_source": self.credentials_source(),
"username_masked": self.mask_username(username),
}