:chore: Initialisation du projet
This commit is contained in:
1 parent
75a8c6addd
commit
6278d19618
27 files changed
+4418
-81
No files matched your search
@@ -0,0 +1,25 @@
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models import ApplicationSetting
|
||||
|
||||
|
||||
def read_setting(db: Session, key: str) -> str | None:
|
||||
item = db.get(ApplicationSetting, key)
|
||||
return item.value if item else None
|
||||
|
||||
|
||||
def write_setting(db: Session, key: str, value: str) -> None:
|
||||
item = db.get(ApplicationSetting, key)
|
||||
if item:
|
||||
item.value = value
|
||||
else:
|
||||
db.add(ApplicationSetting(key=key, value=value))
|
||||
|
||||
|
||||
def radarr_credentials(db: Session) -> tuple[str, str]:
|
||||
url = read_setting(db, "radarr_url")
|
||||
api_key = read_setting(db, "radarr_api_key")
|
||||
if not url or not api_key:
|
||||
raise ValueError("La connexion Radarr n'est pas configurée")
|
||||
return url.rstrip("/"), api_key
|
||||
|
||||
Reference in new issue
Block a user