fixes and improvements
This commit is contained in:
@@ -21,12 +21,12 @@ logger = logging.getLogger(__name__)
|
||||
class Settings(BaseSettings):
|
||||
"""Flat application settings read from env vars / .env file."""
|
||||
|
||||
# Jellyfin
|
||||
# Jellyfin (legacy fallback only; machine settings are preferred)
|
||||
jellyfin_url: str = ""
|
||||
jellyfin_api_key: str = ""
|
||||
jellyfin_user_id: str = ""
|
||||
|
||||
# Jellyseerr (optional)
|
||||
# Jellyseerr (legacy fallback only; machine settings are preferred)
|
||||
jellyseerr_url: str = ""
|
||||
jellyseerr_api_key: str = ""
|
||||
|
||||
@@ -51,13 +51,15 @@ class Settings(BaseSettings):
|
||||
smtp_use_ssl: bool = False
|
||||
smtp_timeout: int = 30
|
||||
|
||||
# SSH
|
||||
# Legacy SSH fallback (new preferred path is machine-specific settings)
|
||||
ssh_host: str = ""
|
||||
ssh_username: str = ""
|
||||
ssh_port: int = 22
|
||||
ssh_key_directory: str = ""
|
||||
ssh_key_name: str = ""
|
||||
ssh_key_file: str = "/run/secrets/ssh_private_key"
|
||||
ssh_password: str = ""
|
||||
ssh_known_hosts_path: str = ""
|
||||
|
||||
# Monitoring poller
|
||||
monitoring_poll_interval_seconds: int = 300
|
||||
@@ -79,10 +81,16 @@ class Settings(BaseSettings):
|
||||
|
||||
@property
|
||||
def ssh_key_path(self) -> str:
|
||||
if self.ssh_key_file:
|
||||
return self.ssh_key_file
|
||||
if not self.ssh_key_directory or not self.ssh_key_name:
|
||||
return ""
|
||||
return str(Path(self.ssh_key_directory) / self.ssh_key_name)
|
||||
|
||||
@property
|
||||
def ssh_known_hosts_file(self) -> Path:
|
||||
return Path(self.ssh_known_hosts_path or ".cache/media_library_viewer/known_hosts")
|
||||
|
||||
model_config = {"env_file": ".env", "env_file_encoding": "utf-8", "extra": "ignore"}
|
||||
|
||||
|
||||
@@ -93,7 +101,6 @@ def _find_env_file() -> str | None:
|
||||
candidate = directory / ".env"
|
||||
if candidate.is_file():
|
||||
return str(candidate)
|
||||
# Stop at repo root (has .git)
|
||||
if (directory / ".git").exists():
|
||||
break
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user