CWA_ENABLED now defaults to false. If a CWA variable is set while CWA is off, the start log has a warning that names it. On the Settings page, the alert about INGEST_DIR moves to Book Downloads and shows with CWA on or off. The Uploads to CWA card moves below Book Downloads.
32 lines
893 B
Python
32 lines
893 B
Python
"""Point every directory at a temporary folder before the app modules load."""
|
|
|
|
import os
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
_tmp = Path(tempfile.mkdtemp(prefix="bindery-tests-"))
|
|
for name, sub in [("CONFIG_DIR", "config"), ("INGEST_DIR", "ingest"), ("TMP_DIR", "tmp")]:
|
|
os.environ[name] = str(_tmp / sub)
|
|
(_tmp / "ingest").mkdir() # Bindery does not make the ingest folder
|
|
os.environ["BINDERY_START_THREADS"] = "false"
|
|
os.environ["UPDATE_INTERVAL_HOURS"] = "0"
|
|
os.environ["CWA_ENABLED"] = "true" # most tests are about a Bindery with CWA
|
|
for name in (
|
|
"CWA_URL",
|
|
"CWA_USERNAME",
|
|
"CWA_PASSWORD",
|
|
"CWA_DB_PATH",
|
|
"CALIBRE_DB_PATH",
|
|
"AUTH_METHOD",
|
|
"BINDERY_USERNAME",
|
|
"BINDERY_PASSWORD_HASH",
|
|
"BINDERY_API_KEY",
|
|
"URL_BASE",
|
|
"CWA_ALLOWED_USERS",
|
|
):
|
|
os.environ.pop(name, None)
|
|
|
|
from bindery import config # noqa: E402
|
|
|
|
config.prepare()
|