summaryrefslogtreecommitdiff
path: root/searx/__init__.py
diff options
context:
space:
mode:
authordalf <alex@al-f.net>2016-10-22 19:07:37 +0200
committerAdam Tauber <asciimoo@gmail.com>2016-10-22 21:36:13 +0200
commit3e7554422b7d177e12838882ed0b84878278825e (patch)
tree0975f15cfd69d581f4fcb31b0944f2401054949b /searx/__init__.py
parente249698b26fcf40ea8fc36897297cc1879fe8ce2 (diff)
downloadsearxng-3e7554422b7d177e12838882ed0b84878278825e.tar.gz
searxng-3e7554422b7d177e12838882ed0b84878278825e.zip
[mod] the environment variable SEARX_DEBUG can override the general.debug value in settings.yml
Diffstat (limited to 'searx/__init__.py')
-rw-r--r--searx/__init__.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/searx/__init__.py b/searx/__init__.py
index 7b67a394f..b3abc61ae 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -42,7 +42,26 @@ else:
with open(settings_path) as settings_yaml:
settings = load(settings_yaml)
-if settings.get('general', {}).get('debug'):
+'''
+enable debug if
+the environnement variable SEARX_DEBUG is 1 or true
+(whatever the value in settings.yml)
+or general.debug=True in settings.yml
+
+disable debug if
+the environnement variable SEARX_DEBUG is 0 or false
+(whatever the value in settings.yml)
+or general.debug=False in settings.yml
+'''
+searx_debug_env = environ.get('SEARX_DEBUG', '').lower()
+if searx_debug_env == 'true' or searx_debug_env == '1':
+ searx_debug = True
+elif searx_debug_env == 'false' or searx_debug_env == '0':
+ searx_debug = False
+else:
+ searx_debug = settings.get('general', {}).get('debug')
+
+if searx_debug:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.WARNING)