mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[mod] the environment variable SEARX_DEBUG can override the general.debug value in settings.yml
This commit is contained in:
parent
e249698b26
commit
3e7554422b
@ -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)
|
||||
|
@ -51,7 +51,7 @@ from flask import (
|
||||
)
|
||||
from flask_babel import Babel, gettext, format_date, format_decimal
|
||||
from flask.json import jsonify
|
||||
from searx import settings, searx_dir
|
||||
from searx import settings, searx_dir, searx_debug
|
||||
from searx.engines import (
|
||||
categories, engines, get_engines_stats, engine_shortcuts
|
||||
)
|
||||
@ -743,8 +743,8 @@ def page_not_found(e):
|
||||
|
||||
def run():
|
||||
app.run(
|
||||
debug=settings['general']['debug'],
|
||||
use_debugger=settings['general']['debug'],
|
||||
debug=searx_debug,
|
||||
use_debugger=searx_debug,
|
||||
port=settings['server']['port'],
|
||||
host=settings['server']['bind_address'],
|
||||
threaded=True
|
||||
|
Loading…
Reference in New Issue
Block a user