diff options
author | Noémi Ványi <sitbackandwait@gmail.com> | 2020-10-09 15:49:48 +0200 |
---|---|---|
committer | Noémi Ványi <sitbackandwait@gmail.com> | 2020-10-09 18:31:42 +0200 |
commit | 116f7a6daaa2d29db30bc0765427d011fa99ce9c (patch) | |
tree | 1955d26682bf8b974e1336d67d404c0b60b7a022 | |
parent | e158eeee4bf69b973659f68a799d5c005aa1c0ae (diff) | |
download | searxng-116f7a6daaa2d29db30bc0765427d011fa99ce9c.tar.gz searxng-116f7a6daaa2d29db30bc0765427d011fa99ce9c.zip |
Force admins to set secret_key if debug mode is disabled
This commit also enables debug mode for unit tests.
-rw-r--r-- | searx/__init__.py | 4 | ||||
-rw-r--r-- | searx/settings_robot.yml | 2 | ||||
-rw-r--r-- | tests/__init__.py | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/searx/__init__.py b/searx/__init__.py index b90cf5358..887ef806d 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -85,3 +85,7 @@ if 'SEARX_SECRET' in environ: 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) diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml index d43f6fe9c..941a43f83 100644 --- a/searx/settings_robot.yml +++ b/searx/settings_robot.yml @@ -8,7 +8,7 @@ search: server: port : 11111 bind_address : 127.0.0.1 - secret_key : "ultrasecretkey" # change this! + secret_key : "changedultrasecretkey" base_url : False http_protocol_version : "1.0" diff --git a/tests/__init__.py b/tests/__init__.py index e69de29bb..18bf7cad8 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,2 @@ +import os +os.environ['SEARX_DEBUG'] = '1' |