Force admins to set secret_key if debug mode is disabled
This commit also enables debug mode for unit tests.
commit116f7a6daaa2d29db30bc0765427d011fa99ce9c
authorNoémi Ványi <sitbackandwait@gmail.com>
dateFri 9 Oct 2020, 15:49 (6 years ago)
parente158eee
searx/__init__.py+4
@@ -85,3 +85,7 @@ if 'SEARX_SECRET' in environ:
8585 settings['server']['secret_key'] = environ['SEARX_SECRET']
8686if 'SEARX_BIND_ADDRESS' in environ:
8787 settings['server']['bind_address'] = environ['SEARX_BIND_ADDRESS']
88+
89+if not searx_debug and settings['server']['secret_key'] == 'ultrasecretkey':
90+ logger.error('server.secret_key is not changed. Please use something else instead of ultrasecretkey.')
91+ exit(1)
searx/settings_robot.yml+1−1
@@ -8,7 +8,7 @@ search:
88server:
99 port : 11111
1010 bind_address : 127.0.0.1
11− secret_key : "ultrasecretkey" # change this!
11+ secret_key : "changedultrasecretkey"
1212 base_url : False
1313 http_protocol_version : "1.0"
1414
tests/__init__.py+2
@@ -0,0 +1,2 @@
1+import os
2+os.environ['SEARX_DEBUG'] = '1'