mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-10 12:28:27 +00:00
Sorry about this one. The environment variable references had also fallen well behind, and again I was a big part of that. A bunch of the gaps come from my own PRs (Hardcover sync, auto-download, the Audiobookshelf library check) where I charged ahead with the functionality and skipped the boring documentation part (did I mention that documentation is boring?). I again had Claude compare the docs to the code and generate the updates, so it would be good to have another human look this over before it merges. The doc diff is just the generator's output. The part worth a real read is the handful of new entries in `scripts/generate_env_docs.py`, since I wrote those descriptions from `entrypoint.sh` and `tor.sh` and not from a settings definition. What changed: - Regenerated `docs/environment-variables.md`. It had 287 variables and the generator now produces 311. The 21 that were missing are the Hardcover Sync tab (6), auto-download (11) and the Audiobookshelf library check (4). Nothing was removed and no existing default, type or option changed. - `SHELFMARK_API_KEY_READONLY` was only ever hand-edited into the doc, so the generator did not know it and a plain regeneration would have dropped the row. It is in the generator now. - Added `UMASK`, `TOR_CHECK_INTERVAL` and `TOR_MAX_FAILURES`. The code reads all three and no doc mentioned them. - The table of contents built its anchors by lowercasing and swapping spaces, so the Webshare.cz and Moly.hu links were already broken (GitHub drops the dots) and Soulseek (slskd) would have broken with the parentheses. They now follow GitHub's rule. Two tests cover the new entries and the anchors, and both fail without the generator change. To regenerate: `python scripts/generate_env_docs.py` on Python 3.14. A test that fails when the committed file differs from the generator output would have caught this drift, but then every PR that adds a setting has to regenerate the doc. I left that out, your call if you want it.
82 lines
2.5 KiB
Python
82 lines
2.5 KiB
Python
from scripts.generate_env_docs import generate_env_docs
|
|
|
|
|
|
def test_generated_env_docs_use_canonical_mirror_env_vars() -> None:
|
|
docs = generate_env_docs()
|
|
|
|
for canonical_var in (
|
|
"AA_BASE_URL",
|
|
"AA_MIRROR_URLS",
|
|
"LIBGEN_MIRROR_URLS",
|
|
"ZLIB_MIRROR_URLS",
|
|
"WELIB_MIRROR_URLS",
|
|
):
|
|
assert f"`{canonical_var}`" in docs
|
|
|
|
for legacy_var in (
|
|
"AA_ADDITIONAL_URLS",
|
|
"LIBGEN_ADDITIONAL_URLS",
|
|
"ZLIB_PRIMARY_URL",
|
|
"ZLIB_ADDITIONAL_URLS",
|
|
"WELIB_PRIMARY_URL",
|
|
"WELIB_ADDITIONAL_URLS",
|
|
):
|
|
assert f"`{legacy_var}`" not in docs
|
|
|
|
assert "https://annas-archive.gl" not in docs
|
|
|
|
|
|
def test_generated_env_docs_describe_mirror_lists_as_comma_separated_strings() -> None:
|
|
docs = generate_env_docs()
|
|
|
|
assert (
|
|
"| `AA_MIRROR_URLS` | List the Anna's Archive mirror URLs you want Shelfmark to use. "
|
|
"Type a URL and press Enter to add it. Order matters when Auto is selected. | "
|
|
"string (comma-separated) | _empty list_ |"
|
|
) in docs
|
|
assert (
|
|
"| `LIBGEN_MIRROR_URLS` | Mirrors are tried in the order you add them until one works. | "
|
|
"string (comma-separated) | _empty list_ |"
|
|
) in docs
|
|
|
|
|
|
def test_generated_env_docs_include_custom_component_value_fields() -> None:
|
|
docs = generate_env_docs()
|
|
|
|
for env_var in (
|
|
"TEMPLATE_RENAME",
|
|
"TEMPLATE_ORGANIZE",
|
|
"TEMPLATE_AUDIOBOOK_RENAME",
|
|
"TEMPLATE_AUDIOBOOK_ORGANIZE",
|
|
):
|
|
assert f"`{env_var}`" in docs
|
|
|
|
assert (
|
|
"| `TEMPLATE_AUDIOBOOK_ORGANIZE` | Use / to create folders. Variables: "
|
|
"{Author}, {FirstAuthor} (first of several authors), {AuthorSort} (first author, surname first), {Title}, {Year}, {Language}, "
|
|
"{User}, {OriginalName} "
|
|
"(source filename without extension), {Series}, {SeriesPosition}, {Subtitle}, "
|
|
"{PrimaryTitle}, {PartNumber}, {Narrator}. Use arbitrary prefix/suffix:"
|
|
) in docs
|
|
|
|
|
|
def test_generated_env_docs_include_startup_variables_read_outside_the_registry() -> None:
|
|
docs = generate_env_docs()
|
|
|
|
for name in (
|
|
"SHELFMARK_API_KEY_READONLY",
|
|
"UMASK",
|
|
"TOR_CHECK_INTERVAL",
|
|
"TOR_MAX_FAILURES",
|
|
):
|
|
assert f"| `{name}` |" in docs
|
|
|
|
|
|
def test_generated_env_docs_toc_anchors_match_github_headings() -> None:
|
|
docs = generate_env_docs()
|
|
|
|
assert "(#soulseek-slskd)" in docs
|
|
assert "(#websharecz)" in docs
|
|
assert "(#soulseek-(slskd))" not in docs
|
|
assert "(#webshare.cz)" not in docs
|