Skip to content

Commit

Permalink
[mod] check secret_key when searx.webapp is imported
Browse files Browse the repository at this point in the history
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 searx#2386
  • Loading branch information
dalf committed Dec 27, 2020
1 parent eb1b528 commit 568b946
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions searx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,3 @@
settings['server']['secret_key'] = environ['SEARX_SECRET']
if 'SEARX_BIND_ADDRESS' in environ:
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)
5 changes: 5 additions & 0 deletions searx/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
from werkzeug.serving import WSGIRequestHandler
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
static_path = get_resources_directory(searx_dir, 'static', settings['ui']['static_path'])
logger.debug('static directory is %s', static_path)
Expand Down
2 changes: 1 addition & 1 deletion utils/standalone_searx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.. code:: bash
$ SEARX_DEBUG=1 python3 utils/standalone_searx.py rain
$ python3 utils/standalone_searx.py rain
Example to run it from python:
Expand Down

0 comments on commit 568b946

Please sign in to comment.