on master help sign in
[mod] check secret_key when searx.webapp is imported

Without this commit the module searx checks the secret_key value. With this commit, make docs, utils/standalone_searx.py, utils/fetch_firefox_version.py works without SEARX_DEBUG=1 For reference see https://github.com/searx/searx/pull/2386

commit568b9465e9480bf408a00982ce0b8ec7462f830c authorAlexandre Flament <alex@al-f.net> dateMon 21 Dec 2020, 10:21 (6 years ago) parenteb1b528
3 files changed+6−5
searx/__init__.py−4 searx/webapp.py+5 utils/standalone_searx.py+1−1
searx/__init__.py−4
@@ -60,7 +60,3 @@ if 'SEARX_SECRET' in environ:
6060 settings['server']['secret_key'] = environ['SEARX_SECRET']
6161if 'SEARX_BIND_ADDRESS' in environ:
6262 settings['server']['bind_address'] = environ['SEARX_BIND_ADDRESS']
63−
64−if not searx_debug and settings['server']['secret_key'] == 'ultrasecretkey':
65− logger.error('server.secret_key is not changed. Please use something else instead of ultrasecretkey.')
66− exit(1)
searx/webapp.py+5
@@ -86,6 +86,11 @@ from searx.metrology.error_recorder import errors_per_engines
8686from werkzeug.serving import WSGIRequestHandler
8787WSGIRequestHandler.protocol_version = "HTTP/{}".format(settings['server'].get('http_protocol_version', '1.0'))
8888
89+# check secret_key
90+if not searx_debug and settings['server']['secret_key'] == 'ultrasecretkey':
91+ logger.error('server.secret_key is not changed. Please use something else instead of ultrasecretkey.')
92+ exit(1)
93+
8994# about static
9095static_path = get_resources_directory(searx_dir, 'static', settings['ui']['static_path'])
9196logger.debug('static directory is %s', static_path)
utils/standalone_searx.py+1−1
@@ -15,7 +15,7 @@ Example to use this script:
1515
1616.. code:: bash
1717
18− $ SEARX_DEBUG=1 python3 utils/standalone_searx.py rain
18+ $ python3 utils/standalone_searx.py rain
1919
2020Example to run it from python:
2121