summaryrefslogtreecommitdiff
path: root/searx/favicons/__init__.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2024-10-22 09:05:00 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-10-23 05:29:15 +0200
commitb14d885f235512572531a5336eb26a97f133f0aa (patch)
tree0592cda28dde23cca0c69de70d9b7a6ce220e04a /searx/favicons/__init__.py
parent050451347b021d05d26c7a0797c790bbd83442e4 (diff)
downloadsearxng-b14d885f235512572531a5336eb26a97f133f0aa.tar.gz
searxng-b14d885f235512572531a5336eb26a97f133f0aa.zip
[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 <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/favicons/__init__.py')
-rw-r--r--searx/favicons/__init__.py5
1 files 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