这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 54 additions & 13 deletions container/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@
# shellcheck shell=dash
set -u

help() {
cat <<EOF
Command line:
-h Display this help

Environment variables:
SEARXNG_SETTINGS_PATH path of the local settings.yml file
UWSGI_SETTINGS_PATH path of the uwsgi.ini wfile
DATA_PATH: default /var/cache/searxng
BIND_ADDRESS default [::]:8080

Environment variables used for settings.yml:
BASE_URL -> server.base_url
INSTANCE_NAME -> general.instance_name
AUTOCOMPLETE -> search.autocomplete

Environment variables used for uwsgi.ini:
UWSGI_WORKERS -> workers
UWSGI_THREADS -> threads
EOF
}

main() {
echo "SearXNG $SEARXNG_VERSION"

# Check for volume mounts
volume_handler "$CONFIG_PATH"
volume_handler "$DATA_PATH"

# Check for updates in files
config_handler "$UWSGI_SETTINGS_PATH" "/usr/local/searxng/.template/uwsgi.ini"
config_handler "$SEARXNG_SETTINGS_PATH" "/usr/local/searxng/searx/settings.yml"

# Update files
setup_uwsgi
setup_searxng

exec /usr/local/searxng/venv/bin/uwsgi --http-socket "$BIND_ADDRESS" "$UWSGI_SETTINGS_PATH"
}

check_file() {
local target="$1"

Expand Down Expand Up @@ -149,18 +189,19 @@ EOF
check_file "$target"
}

echo "SearXNG $SEARXNG_VERSION"

# Check for volume mounts
volume_handler "$CONFIG_PATH"
volume_handler "$DATA_PATH"

# Check for updates in files
config_handler "$UWSGI_SETTINGS_PATH" "/usr/local/searxng/.template/uwsgi.ini"
config_handler "$SEARXNG_SETTINGS_PATH" "/usr/local/searxng/searx/settings.yml"

# Update files
setup_uwsgi
setup_searxng
while getopts "h" option
do
case $option in
h)
help
exit 0
;;
*)
echo "unknow option ${option}"
exit 42
;;
esac
done

exec /usr/local/searxng/venv/bin/uwsgi --http-socket "$BIND_ADDRESS" "$UWSGI_SETTINGS_PATH"
main
2 changes: 1 addition & 1 deletion docs/dev/result_types/main_result.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The :ref:`LegacyResult <LegacyResult>` is used internally for the results that
have not yet been typed. The templates can be used as orientation until the
final typing is complete.

- :ref:`template default` / :py:obj:`Result`
- :ref:`template default` / :py:obj:`MainResult`
- :ref:`template images`
- :ref:`template videos`
- :ref:`template torrent`
Expand Down