feat: fallback when openssl unavailable

This commit is contained in:
martin legrand
2025-06-02 21:52:24 +02:00
parent 5542914725
commit da6056e94c
+12 -2
View File
@@ -89,8 +89,18 @@ sleep 4
docker stop $(docker ps -a -q) docker stop $(docker ps -a -q)
echo "All containers stopped" echo "All containers stopped"
# export searxng secret key # export searxng secret key (cross-platform)
export SEARXNG_SECRET_KEY=$(openssl rand -hex 32) if command -v openssl &> /dev/null; then
export SEARXNG_SECRET_KEY=$(openssl rand -hex 32)
else
# Fallback: use Python if openssl is not available
if command -v python3 &> /dev/null; then
export SEARXNG_SECRET_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")
else
echo "Error: Neither openssl nor python is available to generate a secret key."
exit 1
fi
fi
if [ "$1" = "full" ]; then if [ "$1" = "full" ]; then
# First start backend and wait for it to be healthy # First start backend and wait for it to be healthy