подгрузка данных для api из env
This commit is contained in:
@@ -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),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user