@@ -1,15 +1,39 @@
11#!/bin/sh
22
3−export SEARX_VERSION=$(su searx -c 'python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)"')
4−printf 'searx version %s\n\n' "${SEARX_VERSION}"
5−
6−export UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
7−export SEARX_SETTINGS_PATH=/etc/searx/settings.yml
3+help() {
4+ printf "Command line:\n\n"
5+ printf " -h Display this help\n"
6+ printf " -d Dry run to update the configuration files.\n"
7+ printf " -f Always update on the configuration files (existing files are renamed with the .old suffix)\n"
8+ printf " Without this option, the new configuration files are copied with the .new suffix\n"
9+ printf "\nEnvironment variables:\n\n"
10+ printf " INSTANCE_NAME settings.yml : general.instance_name\n"
11+ printf " AUTOCOMPLETE settings.yml : search.autocomplete\n"
12+ printf " BASE_URL settings.yml : server.base_url\n"
13+ printf " MORTY_URL settings.yml : result_proxy.url\n"
14+ printf " MORTY_KEY settings.yml : result_proxy.key\n"
15+ printf " BIND_ADDRESS uwsgi bind to the specified TCP socket using HTTP protocol. Default value: \"${DEFAULT_BIND_ADDRESS}\"\n"
16+ printf "\nVolume:\n\n"
17+ printf " /etc/searx the docker entry point copies settings.yml and uwsgi.ini in this directory (see the -f command line option)\n"
18+ exit 0
19+}
820
21+export DEFAULT_BIND_ADDRESS="0.0.0.0:8080"
922if [ -z "${BIND_ADDRESS}" ]; then
10− export BIND_ADDRESS=":8080"
23+ export BIND_ADDRESS="${DEFAULT_BIND_ADDRESS}"
1124fi
1225
26+export SEARX_VERSION=$(su searx -c 'python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)"' 2>/dev/null)
27+if [ -z "${SEARX_VERSION}" ]; then
28+ # outside docker, display help
29+ help
30+else
31+ printf 'searx version %s\n\n' "${SEARX_VERSION}"
32+fi
33+
34+export UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
35+export SEARX_SETTINGS_PATH=/etc/searx/settings.yml
36+
1337# Parse command line
1438FORCE_CONF_UPDATE=0
1539DRY_RUN=0
@@ -23,19 +47,7 @@ do
2347 DRY_RUN=1
2448 ;;
2549 h)
26− printf "Command line:\n\n"
27− printf " -h Display this help\n"
28− printf " -d Dry run to update the configuration files.\n"
29− printf " -f Always update on the configuration files (existing files are renamed with the .old suffix)\n"
30− printf " Without this option, new configuration files are copied with the .new suffix\n"
31− printf "\nEnvironment variables:\n\n"
32− printf " INSTANCE_NAME settings.yml : general.instance_name\n"
33− printf " AUTOCOMPLETE settings.yml : search.autocomplete\n"
34− printf " BASE_URL settings.yml : server.base_url\n"
35− printf " MORTY_URL settings.yml : result_proxy.url\n"
36− printf " MORTY_KEY settings.yml : result_proxy.key\n"
37− printf " BIND_ADDRESS where uwsgi will accept HTTP request (format : host:port)\n"
38− exit 0
50+ help
3951 esac
4052done
4153