summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-27 18:04:53 +0100
committerGitHub <noreply@github.com>2020-12-27 18:04:53 +0100
commit5fb9a5c7c10252b21a23fe66e1625ed9f8691b4a (patch)
treea878155a22025da3c7540ed19563ea70a17eb316
parent5840499bfb2a641361e35570e08b3d21abcb73f0 (diff)
parent568b9465e9480bf408a00982ce0b8ec7462f830c (diff)
downloadsearxng-5fb9a5c7c10252b21a23fe66e1625ed9f8691b4a.tar.gz
searxng-5fb9a5c7c10252b21a23fe66e1625ed9f8691b4a.zip
Merge pull request #2411 from dalf/update-secret-key-check
Update secret key check
-rw-r--r--docs/admin/engines.rst2
-rw-r--r--docs/admin/plugins.rst2
-rw-r--r--docs/conf.py10
-rw-r--r--docs/dev/reST.rst16
-rw-r--r--searx/__init__.py4
-rwxr-xr-xsearx/webapp.py5
-rwxr-xr-xutils/standalone_searx.py2
7 files changed, 27 insertions, 14 deletions
diff --git a/docs/admin/engines.rst b/docs/admin/engines.rst
index 0ec86a614..3ad206303 100644
--- a/docs/admin/engines.rst
+++ b/docs/admin/engines.rst
@@ -46,7 +46,7 @@ Show errors **DE**
.. _configured engines:
-.. jinja:: webapp
+.. jinja:: searx
.. flat-table:: Engines configured at built time (defaults)
:header-rows: 1
diff --git a/docs/admin/plugins.rst b/docs/admin/plugins.rst
index 4ed9066fd..d97b3dada 100644
--- a/docs/admin/plugins.rst
+++ b/docs/admin/plugins.rst
@@ -14,7 +14,7 @@ Configuration defaults (at built time):
.. _configured plugins:
-.. jinja:: webapp
+.. jinja:: searx
.. flat-table:: Plugins configured at built time (defaults)
:header-rows: 1
diff --git a/docs/conf.py b/docs/conf.py
index d6fde9bec..0c07761a8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -27,9 +27,15 @@ numfig = True
exclude_patterns = ['build-templates/*.rst']
-from searx import webapp
+import searx.search
+import searx.engines
+import searx.plugins
+searx.search.initialize()
jinja_contexts = {
- 'webapp': dict(**webapp.__dict__),
+ 'searx': {
+ 'engines': searx.engines.engines,
+ 'plugins': searx.plugins.plugins
+ },
}
# usage:: lorem :patch:`f373169` ipsum
diff --git a/docs/dev/reST.rst b/docs/dev/reST.rst
index 8adf4115e..39cd9f671 100644
--- a/docs/dev/reST.rst
+++ b/docs/dev/reST.rst
@@ -1289,15 +1289,21 @@ build chapter: :ref:`engines generic`. Below the jinja directive from the
:language: reST
:start-after: .. _configured engines:
-The context for the template is selected in the line ``.. jinja:: webapp``. In
-sphinx's build configuration (:origin:`docs/conf.py`) the ``webapp`` context
-points to the name space of the python module: ``webapp``.
+The context for the template is selected in the line ``.. jinja:: searx``. In
+sphinx's build configuration (:origin:`docs/conf.py`) the ``searx`` context
+contains the ``engines`` and ``plugins``.
.. code:: py
- from searx import webapp
+ import searx.search
+ import searx.engines
+ import searx.plugins
+ searx.search.initialize()
jinja_contexts = {
- 'webapp': dict(**webapp.__dict__)
+ 'searx': {
+ 'engines': searx.engines.engines,
+ 'plugins': searx.plugins.plugins
+ },
}
diff --git a/searx/__init__.py b/searx/__init__.py
index 9bbc7c8c3..08e67f69d 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -60,7 +60,3 @@ 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/webapp.py b/searx/webapp.py
index 5076355d0..49750d210 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -86,6 +86,11 @@ from searx.metrology.error_recorder import errors_per_engines
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)
diff --git a/utils/standalone_searx.py b/utils/standalone_searx.py
index c52035fb9..89023f41b 100755
--- a/utils/standalone_searx.py
+++ b/utils/standalone_searx.py
@@ -15,7 +15,7 @@ Example to use this script:
.. code:: bash
- $ SEARX_DEBUG=1 python3 utils/standalone_searx.py rain
+ $ python3 utils/standalone_searx.py rain
Example to run it from python: