- Metron:
COMICBOX_METRON_USER,COMICBOX_METRON_PASS,COMICBOX_METRON_URL - ComicVine:
COMICBOX_COMICVINE_KEY,COMICBOX_COMICVINE_URL
comicbox.formats.base.online.env¶
source module comicbox.formats.base.online.env
Environment-variable helpers for online tagging settings.
The resolution chain layers CLI > env > config > keyring; this module owns the env layer.
Two env-var families:
1. Per-source credentials — ``COMICBOX_
2. Online lookup / cache / tuning settings — ``COMICBOX_ONLINE_
COMICBOX_ONLINE_MATCH, COMICBOX_ONLINE_PROMPTS, COMICBOX_ONLINE_REMATCH, COMICBOX_ONLINE_ALL_SOURCES, COMICBOX_ONLINE_AUTO_THRESHOLD, COMICBOX_ONLINE_EFFORT, COMICBOX_ONLINE_CACHE, COMICBOX_ONLINE_CACHE_DIR, COMICBOX_ONLINE_CACHE_TTL, COMICBOX_ONLINE_RETRY_BUDGET.
Both groups are read explicitly here (rather than via confuse’s set_env) so behavior is predictable across nested template depths.
Functions
-
parse_bool — Parse a boolean env-var value; return None if unrecognised.
-
read_credential_env — Read per-source credentials from
COMICBOX_<SOURCE>_<FIELD>vars. -
read_online_env — Read online lookup / cache / tuning settings from
COMICBOX_ONLINE_*vars.
source parse_bool(value: str) → bool | None
Parse a boolean env-var value; return None if unrecognised.
source read_credential_env(env: Mapping[str, str]) → dict[str, dict[str, str]]
Read per-source credentials from COMICBOX_<SOURCE>_<FIELD> vars.
Returns a dict mapping source name → field dict, omitting any source or field that has no env var set. Field names match OnlineSourceCredentials attributes.
source read_online_env(env: Mapping[str, str]) → dict[str, Any]
Read online lookup / cache / tuning settings from COMICBOX_ONLINE_* vars.
Returns a dict keyed by resolved field name; missing env vars are omitted. Booleans, floats, and ints are parsed; strings are returned as-is. Unparseable values are dropped.