Spaces:
Sleeping
Sleeping
File size: 1,591 Bytes
a0709fa da933f6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #!/bin/bash
# v7 — Process-safe launcher
cd /usr/local/searxng
# Patch settings (same logic as your old run.sh but simplified)
python3 << 'PYEOF'
import secrets, os
f = os.environ.get("SEARXNG_SETTINGS_PATH", "/etc/searxng/settings.yml")
if not os.path.exists(f):
f = "searx/settings.yml"
lines = open(f).readlines()
output = []
json_added = False
for line in lines:
s = line.strip()
if "ultrasecretkey" in line:
line = line.replace("ultrasecretkey", secrets.token_hex(32))
if s.startswith("port:") and "8080" in s:
line = line.replace("8080", "7860")
if "bind_address" in s and "127.0.0.1" in s:
line = line.replace("127.0.0.1", "0.0.0.0")
if s.startswith("limiter:") and "true" in s:
line = line.replace("true", "false")
if s.startswith("image_proxy:") and "true" in s:
line = line.replace("true", "false")
if s == "- html" and not json_added:
output.append(line)
indent = line[:len(line) - len(line.lstrip())]
output.append(f"{indent}- json\n")
json_added = True
continue
output.append(line)
open(f, "w").writelines(output)
print(f"Settings patched, json_format={json_added}")
PYEOF
echo "Starting engine on port 7860..."
# Run via werkzeug — process name is "python3", not "searxng" or "granian"
exec python3 -c "
import os
os.environ['SEARXNG_SETTINGS_PATH'] = '/etc/searxng/settings.yml'
os.chdir('/usr/local/searxng')
from searx.webapp import app
from werkzeug.serving import run_simple
run_simple('0.0.0.0', 7860, app, threaded=True, use_reloader=False)
"
|