diff options
author | Alexandre Flament <alex@al-f.net> | 2020-12-03 11:47:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 11:47:53 +0100 |
commit | 7905d4148718816de60cafff8a05ce95f97ce6aa (patch) | |
tree | 9980b24421de0b12670b2ede2edc42a73ba6df42 | |
parent | 89fbb85d454959be725cd4ca19c36c31d05d3289 (diff) | |
parent | d0d7a3e1c2d75fb0d9be3594ab113a804e4462a4 (diff) | |
download | searxng-7905d4148718816de60cafff8a05ce95f97ce6aa.tar.gz searxng-7905d4148718816de60cafff8a05ce95f97ce6aa.zip |
Merge pull request #2349 from dalf/fix-settings-loader
[fix] settings_loader: don't crash when a key exists only in the user settings
-rw-r--r-- | searx/settings_loader.py | 5 | ||||
-rw-r--r-- | tests/unit/settings/user_settings_simple.yml | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/searx/settings_loader.py b/searx/settings_loader.py index 172069bd5..5dbeb4a9a 100644 --- a/searx/settings_loader.py +++ b/searx/settings_loader.py @@ -57,7 +57,10 @@ def update_settings(default_settings, user_settings): # merge everything except the engines for k, v in user_settings.items(): if k not in ('use_default_settings', 'engines'): - update_dict(default_settings[k], v) + if k in default_settings: + update_dict(default_settings[k], v) + else: + default_settings[k] = v # parse the engines remove_engines = None diff --git a/tests/unit/settings/user_settings_simple.yml b/tests/unit/settings/user_settings_simple.yml index 36e5f1647..bc6ed0cfe 100644 --- a/tests/unit/settings/user_settings_simple.yml +++ b/tests/unit/settings/user_settings_simple.yml @@ -4,3 +4,6 @@ server: bind_address: "0.0.0.0" default_http_headers: Custom-Header: Custom-Value +result_proxy: + url : https://localhost/morty + key : "$ecretKey" |