diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-09-20 18:08:40 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-10-05 08:18:28 +0200 |
commit | a7d02d4101c3e2ed3d35130466574c80f4d3583d (patch) | |
tree | 5e0fb2d37af35b2ec26eca8f33f621501bd4c430 /searx/favicons | |
parent | 5ded9ada823e12be96514505ba08157356d75ea7 (diff) | |
download | searxng-a7d02d4101c3e2ed3d35130466574c80f4d3583d.tar.gz searxng-a7d02d4101c3e2ed3d35130466574c80f4d3583d.zip |
[doc] documentation of the favicons infrastructure
Run ``make docs.live`` and visit http://0.0.0.0:8000/admin/searx.favicons.html
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/favicons')
-rw-r--r-- | searx/favicons/__init__.py | 2 | ||||
-rw-r--r-- | searx/favicons/config.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/searx/favicons/__init__.py b/searx/favicons/__init__.py index 2a9893932..2b3da1016 100644 --- a/searx/favicons/__init__.py +++ b/searx/favicons/__init__.py @@ -27,7 +27,7 @@ def init(): if not cfg_file.exists(): if is_active(): logger.error(f"missing favicon config: {cfg_file}") - cfg_file = config.DEFAULT_CFG_TOML + cfg_file = config.DEFAULT_CFG_TOML_PATH logger.debug(f"load favicon config: {cfg_file}") cfg = config.FaviconConfig.from_toml_file(cfg_file, use_cache=True) diff --git a/searx/favicons/config.py b/searx/favicons/config.py index 1c18b1631..e244de52b 100644 --- a/searx/favicons/config.py +++ b/searx/favicons/config.py @@ -13,10 +13,10 @@ from .proxy import FaviconProxyConfig CONFIG_SCHEMA: int = 1 """Version of the configuration schema.""" -TOML_CACHE: dict[str, "FaviconConfig"] = {} +TOML_CACHE_CFG: dict[str, "FaviconConfig"] = {} """Cache config objects by TOML's filename.""" -DEFAULT_CFG_TOML = pathlib.Path(__file__).parent / "favicons.toml" +DEFAULT_CFG_TOML_PATH = pathlib.Path(__file__).parent / "favicons.toml" class FaviconConfig(BaseModel): @@ -40,7 +40,7 @@ class FaviconConfig(BaseModel): specifies whether a cache should be used. """ - cached = TOML_CACHE.get(str(cfg_file)) + cached = TOML_CACHE_CFG.get(str(cfg_file)) if use_cache and cached: return cached @@ -57,6 +57,6 @@ class FaviconConfig(BaseModel): cfg = cls(**cfg) if use_cache and cached: - TOML_CACHE[str(cfg_file.resolve())] = cfg + TOML_CACHE_CFG[str(cfg_file.resolve())] = cfg return cfg |