summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlexandre FLAMENT <alexandre.flament@hesge.ch>2022-10-14 13:27:07 +0000
committerAlexandre Flament <alex@al-f.net>2022-11-05 17:45:52 +0100
commite92755d358df5b34b0181f48f8ba02c7f2939e8f (patch)
tree181d2b38112d9439f836e6d9a286f5355a311ffa /utils
parentfe419e355bf1527c51e3aee98495d08b89510320 (diff)
Initialize Redis in searx/webapp.py
settings.yml: * The default URL was unix:///usr/local/searxng-redis/run/redis.sock?db=0 * The default URL is now "false" The default URL makes the log difficult to deal with: if the admin didn't install a Redis instance, the logs record a false error. It worked before because SearXNG initialized the Redis connection when the limiter started. In this commit, SearXNG initializes Redis in searx/webapp.py so various components can use Redis without taking care of the initialization step.
Diffstat (limited to 'utils')
-rwxr-xr-xutils/searxng.sh4
-rw-r--r--utils/searxng_check.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/utils/searxng.sh b/utils/searxng.sh
index 58f220e1..e7aa8ed1 100755
--- a/utils/searxng.sh
+++ b/utils/searxng.sh
@@ -295,7 +295,7 @@ In your instance, redis DB connector is configured at:
${redis_url}
"
- if searxng.instance.exec python -c "from searx.shared import redisdb; redisdb.init() or exit(42)"; then
+ if searxng.instance.exec python -c "from searx.shared import redisdb; redisdb.initialize() or exit(42)"; then
info_msg "SearXNG instance is able to connect redis DB."
return
fi
@@ -684,7 +684,7 @@ To install uWSGI use::
die 42 "SearXNG's uWSGI app not available"
fi
- if ! searxng.instance.exec python -c "from searx.shared import redisdb; redisdb.init() or exit(42)"; then
+ if ! searxng.instance.exec python -c "from searx.shared import redisdb; redisdb.initialize() or exit(42)"; then
rst_para "\
The configured redis DB is not available: If your server is public to the
internet, you should setup a bot protection to block excessively bot queries.
diff --git a/utils/searxng_check.py b/utils/searxng_check.py
index 39e77434..bd2d6028 100644
--- a/utils/searxng_check.py
+++ b/utils/searxng_check.py
@@ -29,6 +29,6 @@ if os.path.isfile(OLD_SETTING):
from searx.shared import redisdb
from searx import get_setting
-if not redisdb.init():
+if not redisdb.initialize():
warnings.warn("can't connect to redis DB at: %s" % get_setting('redis.url'), RuntimeWarning, stacklevel=2)
warnings.warn("--> no bot protection without redis DB", RuntimeWarning, stacklevel=2)