mirror of https://github.com/searxng/searxng.git
Merge pull request #2411 from dalf/update-secret-key-check
Update secret key check
This commit is contained in:
commit
5fb9a5c7c1
|
@ -46,7 +46,7 @@ Show errors **DE**
|
||||||
|
|
||||||
.. _configured engines:
|
.. _configured engines:
|
||||||
|
|
||||||
.. jinja:: webapp
|
.. jinja:: searx
|
||||||
|
|
||||||
.. flat-table:: Engines configured at built time (defaults)
|
.. flat-table:: Engines configured at built time (defaults)
|
||||||
:header-rows: 1
|
:header-rows: 1
|
||||||
|
|
|
@ -14,7 +14,7 @@ Configuration defaults (at built time):
|
||||||
|
|
||||||
.. _configured plugins:
|
.. _configured plugins:
|
||||||
|
|
||||||
.. jinja:: webapp
|
.. jinja:: searx
|
||||||
|
|
||||||
.. flat-table:: Plugins configured at built time (defaults)
|
.. flat-table:: Plugins configured at built time (defaults)
|
||||||
:header-rows: 1
|
:header-rows: 1
|
||||||
|
|
10
docs/conf.py
10
docs/conf.py
|
@ -27,9 +27,15 @@ numfig = True
|
||||||
|
|
||||||
exclude_patterns = ['build-templates/*.rst']
|
exclude_patterns = ['build-templates/*.rst']
|
||||||
|
|
||||||
from searx import webapp
|
import searx.search
|
||||||
|
import searx.engines
|
||||||
|
import searx.plugins
|
||||||
|
searx.search.initialize()
|
||||||
jinja_contexts = {
|
jinja_contexts = {
|
||||||
'webapp': dict(**webapp.__dict__),
|
'searx': {
|
||||||
|
'engines': searx.engines.engines,
|
||||||
|
'plugins': searx.plugins.plugins
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# usage:: lorem :patch:`f373169` ipsum
|
# usage:: lorem :patch:`f373169` ipsum
|
||||||
|
|
|
@ -1289,15 +1289,21 @@ build chapter: :ref:`engines generic`. Below the jinja directive from the
|
||||||
:language: reST
|
:language: reST
|
||||||
:start-after: .. _configured engines:
|
:start-after: .. _configured engines:
|
||||||
|
|
||||||
The context for the template is selected in the line ``.. jinja:: webapp``. In
|
The context for the template is selected in the line ``.. jinja:: searx``. In
|
||||||
sphinx's build configuration (:origin:`docs/conf.py`) the ``webapp`` context
|
sphinx's build configuration (:origin:`docs/conf.py`) the ``searx`` context
|
||||||
points to the name space of the python module: ``webapp``.
|
contains the ``engines`` and ``plugins``.
|
||||||
|
|
||||||
.. code:: py
|
.. code:: py
|
||||||
|
|
||||||
from searx import webapp
|
import searx.search
|
||||||
|
import searx.engines
|
||||||
|
import searx.plugins
|
||||||
|
searx.search.initialize()
|
||||||
jinja_contexts = {
|
jinja_contexts = {
|
||||||
'webapp': dict(**webapp.__dict__)
|
'searx': {
|
||||||
|
'engines': searx.engines.engines,
|
||||||
|
'plugins': searx.plugins.plugins
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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)
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue