summaryrefslogtreecommitdiff
path: root/searx/settings_loader.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-10-08 11:26:59 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2021-10-11 12:28:55 +0000
commit861925c50f91f804564c4f6a13de9dfed5fe8e26 (patch)
tree575d93773ca087fb41b9dc45d8e2798e4227e293 /searx/settings_loader.py
parent7f72844ca679d64e56412c4b86f17d1b3b526ae0 (diff)
downloadsearxng-861925c50f91f804564c4f6a13de9dfed5fe8e26.tar.gz
searxng-861925c50f91f804564c4f6a13de9dfed5fe8e26.zip
SearXNG: load /etc/searxng/settings.yml
fall back to /etc/searx/setting.yml
Diffstat (limited to 'searx/settings_loader.py')
-rw-r--r--searx/settings_loader.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/searx/settings_loader.py b/searx/settings_loader.py
index 51e5456d5..f688be8ba 100644
--- a/searx/settings_loader.py
+++ b/searx/settings_loader.py
@@ -43,8 +43,16 @@ def get_user_settings_path():
if environ.get('SEARXNG_DISABLE_ETC_SETTINGS', '').lower() in ('1', 'true'):
return None
- # if not, get it from searx code base or last solution from /etc/searx
- return check_settings_yml('/etc/searx/settings.yml')
+ # if not, get it from searx code base or last solution from /etc/searxng
+ try:
+ return check_settings_yml('/etc/searxng/settings.yml')
+ except SearxSettingsException as e:
+ # fall back to searx settings
+ try:
+ return check_settings_yml('/etc/searx/settings.yml')
+ except SearxSettingsException:
+ # if none are found, raise the exception about SearXNG
+ raise e # pylint: disable=raise-missing-from
def update_dict(default_dict, user_dict):