cwa import
This commit is contained in:
@@ -14,18 +14,11 @@ class SFTPConfig:
|
||||
remote_path: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class CalibreConfig:
|
||||
url: str = ""
|
||||
user: str = ""
|
||||
password: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class AppConfig:
|
||||
sftp: SFTPConfig = field(default_factory=SFTPConfig)
|
||||
calibre: CalibreConfig = field(default_factory=CalibreConfig)
|
||||
local_work_dir: str = "/tmp/calibresync"
|
||||
work_dir: str = "/tmp/calibresync"
|
||||
import_dir: str = ""
|
||||
|
||||
|
||||
def load() -> AppConfig:
|
||||
@@ -40,12 +33,8 @@ def load() -> AppConfig:
|
||||
password=s.get("sftp_password", ""),
|
||||
remote_path=s.get("sftp_remote_path", ""),
|
||||
),
|
||||
calibre=CalibreConfig(
|
||||
url=s.get("calibre_url", "").rstrip("/"),
|
||||
user=s.get("calibre_user", ""),
|
||||
password=s.get("calibre_pass", ""),
|
||||
),
|
||||
local_work_dir=s.get("local_work_dir", "/tmp/calibresync"),
|
||||
work_dir=s.get("work_dir", "/tmp/calibresync"),
|
||||
import_dir=s.get("import_dir", ""),
|
||||
)
|
||||
|
||||
|
||||
@@ -53,8 +42,8 @@ def save(form: dict) -> None:
|
||||
keys = [
|
||||
"sftp_host", "sftp_port", "sftp_user", "sftp_auth_method",
|
||||
"sftp_password", "sftp_remote_path",
|
||||
"calibre_url", "calibre_user", "calibre_pass",
|
||||
"local_work_dir", "scheduler_interval_minutes", "sync_batch_size",
|
||||
"work_dir", "import_dir",
|
||||
"scheduler_interval_minutes", "sync_batch_size",
|
||||
]
|
||||
for key in keys:
|
||||
if key in form and form[key] is not None:
|
||||
|
||||
Reference in New Issue
Block a user