From b14d885f235512572531a5336eb26a97f133f0aa Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 22 Oct 2024 09:05:00 +0200 Subject: [PATCH] [fix] favicons: don't hard code settings folder to /etc/searxng The location of the local settings depends on environment ``SEARXNG_SETTINGS_PATH`` and can be different from ``/etc/searxng``. Issue was reported on Matrix [1]. To get the location function ``searx.settings_loader.get_user_cfg_folder()`` should be used. [1] https://matrix.to/#/!vxScbLNEAmRvOraXBn:matrix.org/$5xNMYvONGB-mPt2B3ttoL27QncRFhkjGkO-TISdmP08?via=matrix.org&via=tchncs.de&via=envs.net Signed-off-by: Markus Heiser --- searx/favicons/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/searx/favicons/__init__.py b/searx/favicons/__init__.py index 2b3da1016..39c4ad716 100644 --- a/searx/favicons/__init__.py +++ b/searx/favicons/__init__.py @@ -22,8 +22,9 @@ def init(): # pylint: disable=import-outside-toplevel from . import config, cache, proxy + from .. import settings_loader - cfg_file = pathlib.Path("/etc/searxng/favicons.toml") + cfg_file = (settings_loader.get_user_cfg_folder() or pathlib.Path("/etc/searxng")) / "favicons.toml" if not cfg_file.exists(): if is_active(): logger.error(f"missing favicon config: {cfg_file}") @@ -34,4 +35,4 @@ def init(): cache.init(cfg.cache) proxy.init(cfg.proxy) - del cache, config, proxy, cfg + del cache, config, proxy, cfg, settings_loader