Spaces:
Sleeping
Sleeping
Commit ·
1e731a0
1
Parent(s): a19333a
Set SEARXNG_SETTINGS_PATH at runtime, not build time
Browse filesSearXNG's setup.py imports searx during metadata generation, which reads
SEARXNG_SETTINGS_PATH. Pointing it at /etc/searxng/settings.yml via ENV made
the editable install fail (file not present yet at that build step). Set the
var in start.sh instead; during build SearXNG uses its packaged defaults.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Dockerfile +0 -1
- start.sh +5 -1
Dockerfile
CHANGED
|
@@ -8,7 +8,6 @@ FROM python:3.11-slim
|
|
| 8 |
ENV PIP_NO_CACHE_DIR=1 \
|
| 9 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
| 10 |
PYTHONUNBUFFERED=1 \
|
| 11 |
-
SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml \
|
| 12 |
SEARXNG_URL=http://127.0.0.1:8080 \
|
| 13 |
DATA_DIR=/data \
|
| 14 |
HOME=/app
|
|
|
|
| 8 |
ENV PIP_NO_CACHE_DIR=1 \
|
| 9 |
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
| 10 |
PYTHONUNBUFFERED=1 \
|
|
|
|
| 11 |
SEARXNG_URL=http://127.0.0.1:8080 \
|
| 12 |
DATA_DIR=/data \
|
| 13 |
HOME=/app
|
start.sh
CHANGED
|
@@ -9,9 +9,13 @@ APP_PY=/opt/appenv/bin/python
|
|
| 9 |
SEARXNG_HOST="127.0.0.1"
|
| 10 |
SEARXNG_PORT="8080"
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# A settings.yml secret_key must be set. If the shipped one is still the
|
| 13 |
# placeholder, generate one at runtime (settings dir is made writable in the image).
|
| 14 |
-
SETTINGS="${SEARXNG_SETTINGS_PATH:-/etc/searxng/settings.yml}"
|
| 15 |
if grep -q 'ultrasecretkey_change_me' "$SETTINGS" 2>/dev/null; then
|
| 16 |
KEY="$("$APP_PY" -c 'import secrets; print(secrets.token_hex(32))')"
|
| 17 |
sed -i "s/ultrasecretkey_change_me/${KEY}/" "$SETTINGS" || true
|
|
|
|
| 9 |
SEARXNG_HOST="127.0.0.1"
|
| 10 |
SEARXNG_PORT="8080"
|
| 11 |
|
| 12 |
+
# Point SearXNG at our settings at runtime only (not during the image build, where
|
| 13 |
+
# the file doesn't exist yet and would break metadata generation).
|
| 14 |
+
export SEARXNG_SETTINGS_PATH="${SEARXNG_SETTINGS_PATH:-/etc/searxng/settings.yml}"
|
| 15 |
+
SETTINGS="$SEARXNG_SETTINGS_PATH"
|
| 16 |
+
|
| 17 |
# A settings.yml secret_key must be set. If the shipped one is still the
|
| 18 |
# placeholder, generate one at runtime (settings dir is made writable in the image).
|
|
|
|
| 19 |
if grep -q 'ultrasecretkey_change_me' "$SETTINGS" 2>/dev/null; then
|
| 20 |
KEY="$("$APP_PY" -c 'import secrets; print(secrets.token_hex(32))')"
|
| 21 |
sed -i "s/ultrasecretkey_change_me/${KEY}/" "$SETTINGS" || true
|