Pipeline: env overrides for endpoints and dirs; voice health check, retries, load-on-demand; refuse speed_factor

This commit is contained in:
Audiobook Producer
2026-10-18 01:34:58 -05:00
parent 67f67ae236
commit 460d4648cb
3 changed files with 115 additions and 8 deletions
+26
View File
@@ -11,9 +11,35 @@ def load(path=None):
with open(path, encoding="utf-8") as f:
cfg = yaml.safe_load(f)
cfg["_path"] = path
apply_env(cfg)
return cfg
# Environment variables that override settings.yaml (used by the CI job; nothing is hard-coded to a host).
ENV_OVERRIDES = [
("AUDIOBOOK_BOOKS_DIR", ("books_dir",)),
("AUDIOBOOK_WORK_DIR", ("work_dir",)),
("AUDIOBOOK_ARCHIVE_DIR", ("archive_dir",)),
("AUDIOBOOK_VOICE_ENDPOINT", ("voice", "endpoint")),
("AUDIOBOOK_LLM_ENDPOINT", ("llm", "endpoint")),
("AUDIOBOOK_LLM_MODEL", ("llm", "model")),
]
def apply_env(cfg, environ=None):
environ = os.environ if environ is None else environ
for var, keys in ENV_OVERRIDES:
value = environ.get(var, "").strip()
if value:
node = cfg
for k in keys[:-1]:
node = node[k]
node[keys[-1]] = value
flag = environ.get("AUDIOBOOK_REQUIRE_OCR", "").strip().lower()
if flag:
cfg["ocr"]["required"] = flag in ("1", "true", "yes")
def resolve(cfg, key):
"""A path setting as an absolute path (relative values are relative to the repo root)."""
value = cfg[key]