1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

[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
This commit is contained in:
Alexandre Flament 2020-12-21 10:21:10 +01:00
parent eb1b5289d5
commit 568b9465e9
3 changed files with 6 additions and 5 deletions

View File

@ -60,7 +60,3 @@ if 'SEARX_SECRET' in environ:
settings['server']['secret_key'] = environ['SEARX_SECRET'] settings['server']['secret_key'] = environ['SEARX_SECRET']
if 'SEARX_BIND_ADDRESS' in environ: if 'SEARX_BIND_ADDRESS' in environ:
settings['server']['bind_address'] = environ['SEARX_BIND_ADDRESS'] settings['server']['bind_address'] = environ['SEARX_BIND_ADDRESS']
if not searx_debug and settings['server']['secret_key'] == 'ultrasecretkey':
logger.error('server.secret_key is not changed. Please use something else instead of ultrasecretkey.')
exit(1)

View File

@ -86,6 +86,11 @@ from searx.metrology.error_recorder import errors_per_engines
from werkzeug.serving import WSGIRequestHandler from werkzeug.serving import WSGIRequestHandler
WSGIRequestHandler.protocol_version = "HTTP/{}".format(settings['server'].get('http_protocol_version', '1.0')) WSGIRequestHandler.protocol_version = "HTTP/{}".format(settings['server'].get('http_protocol_version', '1.0'))
# check secret_key
if not searx_debug and settings['server']['secret_key'] == 'ultrasecretkey':
logger.error('server.secret_key is not changed. Please use something else instead of ultrasecretkey.')
exit(1)
# about static # about static
static_path = get_resources_directory(searx_dir, 'static', settings['ui']['static_path']) static_path = get_resources_directory(searx_dir, 'static', settings['ui']['static_path'])
logger.debug('static directory is %s', static_path) logger.debug('static directory is %s', static_path)

View File

@ -15,7 +15,7 @@ Example to use this script:
.. code:: bash .. code:: bash
$ SEARX_DEBUG=1 python3 utils/standalone_searx.py rain $ python3 utils/standalone_searx.py rain
Example to run it from python: Example to run it from python: