From a9fc4885f2d4ab3fba8fd9fbaa0386090250bd11 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 11 Oct 2021 19:59:34 +0200 Subject: [PATCH] [brand] SearXNG - bash env SEARXNG_URL Signed-off-by: Markus Heiser --- docs/admin/engines/settings.rst | 2 +- docs/conf.py | 4 ++-- docs/dev/makefile.rst | 2 +- utils/brand.env | 2 +- utils/build_env.py | 2 +- utils/filtron.sh | 2 +- utils/lib_install.sh | 14 +++++++------- utils/morty.sh | 2 +- utils/searx.sh | 4 ++-- .../etc/httpd/sites-available/searx.conf:uwsgi | 4 ++-- .../default.apps-available/searx.conf:filtron | 6 +++--- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst index 7a354afee..c67b45669 100644 --- a/docs/admin/engines/settings.rst +++ b/docs/admin/engines/settings.rst @@ -109,7 +109,7 @@ Global Settings Changing a value tagged by :ref:`buildenv `, needs to rebuild instance's environment :ref:`utils/brand.env `. -``base_url`` : :ref:`buildenv SEARX_URL ` +``base_url`` : :ref:`buildenv SEARXNG_URL ` The base URL where SearXNG is deployed. Used to create correct inbound links. If you change the value, don't forget to rebuild instance's environment (:ref:`utils/brand.env `) diff --git a/docs/conf.py b/docs/conf.py index da36db88a..4828679e8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,7 @@ copyright = '2021 SearXNG team, 2015-2021 Adam Tauber, Noémi Ványi' author = '2021 SearXNG team, 2015-2021 Adam Tauber' release, version = VERSION_STRING, VERSION_STRING -SEARX_URL = get_setting('server.base_url') or 'https://example.org/searxng' +SEARXNG_URL = get_setting('server.base_url') or 'https://example.org/searxng' ISSUE_URL = get_setting('brand.issue_url') DOCS_URL = get_setting('brand.docs_url') PUBLIC_INSTANCES = get_setting('brand.public_instances') @@ -58,7 +58,7 @@ extlinks['pull-searx'] = ('https://github.com/searx/searx/pull/%s', 'PR ') # links to custom brand extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://') extlinks['patch'] = (GIT_URL + '/commit/%s', '#') -extlinks['search'] = (SEARX_URL + '/%s', '#') +extlinks['search'] = (SEARXNG_URL + '/%s', '#') extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ') extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ') extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '') diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst index 1db3ed703..6e563b1bd 100644 --- a/docs/dev/makefile.rst +++ b/docs/dev/makefile.rst @@ -107,7 +107,7 @@ The ``make buildenv`` target will update the *build environment* in: Tasks running outside of an *installed instance*, need the following settings from the YAML configuration: -- ``SEARX_URL`` from :ref:`server.base_url ` (aka +- ``SEARXNG_URL`` from :ref:`server.base_url ` (aka ``PUBLIC_URL``) - ``SEARXNG_BIND_ADDRESS`` from :ref:`server.bind_address ` - ``SEARXNG_PORT`` from :ref:`server.port ` diff --git a/utils/brand.env b/utils/brand.env index 5cc2af35b..31afce53c 100644 --- a/utils/brand.env +++ b/utils/brand.env @@ -1,4 +1,4 @@ -export SEARX_URL='' +export SEARXNG_URL='' export SEARXNG_PORT='8888' export SEARXNG_BIND_ADDRESS='127.0.0.1' export GIT_URL='https://github.com/searxng/searxng' diff --git a/utils/build_env.py b/utils/build_env.py index cd2fc2d04..709da6815 100644 --- a/utils/build_env.py +++ b/utils/build_env.py @@ -28,7 +28,7 @@ def _env(*arg, **kwargs): name_val = [ - ('SEARX_URL' , 'server.base_url'), + ('SEARXNG_URL' , 'server.base_url'), ('SEARXNG_PORT' , 'server.port'), ('SEARXNG_BIND_ADDRESS' , 'server.bind_address'), diff --git a/utils/filtron.sh b/utils/filtron.sh index eb34b2413..e4a4d32e8 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -560,7 +560,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE} # shellcheck disable=SC2034 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) # shellcheck disable=SC2034 - SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH) + SEARXNG_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_URL_PATH) nginx_install_app --variant=filtron "${NGINX_FILTRON_SITE}" info_msg "testing public url .." diff --git a/utils/lib_install.sh b/utils/lib_install.sh index 4fd63b830..4a251c096 100755 --- a/utils/lib_install.sh +++ b/utils/lib_install.sh @@ -116,9 +116,9 @@ install_log_searx_instance() { echo -e "---- SearXNG instance setup ${_BBlue}(status: $(install_searx_get_state))${_creset}" echo -e " SEARXNG_SETTINGS_PATH : ${_BBlue}${SEARXNG_SETTINGS_PATH}${_creset}" - echo -e " SSEARX_PYENV : ${_BBlue}${SEARX_PYENV}${_creset}" + echo -e " SEARX_PYENV : ${_BBlue}${SEARX_PYENV}${_creset}" echo -e " SEARX_SRC : ${_BBlue}${SEARX_SRC:-none}${_creset}" - echo -e " SEARX_URL : ${_BBlue}${SEARX_URL:-none}${_creset}" + echo -e " SEARXNG_URL : ${_BBlue}${SEARXNG_URL:-none}${_creset}" if in_container; then # searx is listening on 127.0.0.1 and not available from outside container @@ -184,17 +184,17 @@ install_searx_get_state(){ # shellcheck source=utils/brand.env source "${REPO_ROOT}/utils/brand.env" -# SEARX_URL aka PUBLIC_URL: the public URL of the instance (e.g. -# "https://example.org/searx"). The value is taken from environment $SEARX_URL +# SEARXNG_URL aka PUBLIC_URL: the public URL of the instance (e.g. +# "https://example.org/searx"). The value is taken from environment $SEARXNG_URL # in ./utils/brand.env. This variable is a empty string if server.base_url in # the settings.yml is set to 'false'. -SEARX_URL="${SEARX_URL:-http://$(uname -n)}" +SEARXNG_URL="${SEARXNG_URL:-http://$(uname -n)}" if in_container; then # hint: Linux containers do not have DNS entries, lets use IPs - SEARX_URL="http://$(primary_ip)" + SEARXNG_URL="http://$(primary_ip)" fi -PUBLIC_URL="${SEARX_URL}" +PUBLIC_URL="${SEARXNG_URL}" source_dot_config diff --git a/utils/morty.sh b/utils/morty.sh index 60220df02..fdbe2b54e 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -513,7 +513,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_MORTY_SITE})" # shellcheck disable=SC2034 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) # shellcheck disable=SC2034 - SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH) + SEARXNG_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_URL_PATH) nginx_install_app "${NGINX_MORTY_SITE}" info_msg "testing public url .." diff --git a/utils/searx.sh b/utils/searx.sh index e3393835c..00ee93010 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -14,9 +14,9 @@ source "${REPO_ROOT}/utils/lib_install.sh" SEARX_INTERNAL_HTTP="${SEARXNG_BIND_ADDRESS}:${SEARXNG_PORT}" -SEARX_URL_PATH="${SEARX_URL_PATH:-$(echo "${PUBLIC_URL}" \ +SEARXNG_URL_PATH="${SEARXNG_URL_PATH:-$(echo "${PUBLIC_URL}" \ | sed -e 's,^.*://[^/]*\(/.*\),\1,g')}" -[[ "${SEARX_URL_PATH}" == "${PUBLIC_URL}" ]] && SEARX_URL_PATH=/ +[[ "${SEARXNG_URL_PATH}" == "${PUBLIC_URL}" ]] && SEARXNG_URL_PATH=/ SERVICE_NAME="searx" SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}" diff --git a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi b/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi index ef702de3a..aabc125ae 100644 --- a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi +++ b/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi @@ -5,10 +5,10 @@ LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so # LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so -# SetEnvIf Request_URI "${SEARX_URL_PATH}" dontlog +# SetEnvIf Request_URI "${SEARXNG_URL_PATH}" dontlog # CustomLog /dev/null combined env=dontlog - + SecRuleEngine Off diff --git a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron b/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron index a89aa38b3..e25461c47 100644 --- a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron +++ b/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron @@ -1,6 +1,6 @@ # https://example.org/searx -location ${SEARX_URL_PATH} { +location ${SEARXNG_URL_PATH} { proxy_pass http://127.0.0.1:4004/; proxy_set_header Host \$host; @@ -8,9 +8,9 @@ location ${SEARX_URL_PATH} { proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Scheme \$scheme; - proxy_set_header X-Script-Name ${SEARX_URL_PATH}; + proxy_set_header X-Script-Name ${SEARXNG_URL_PATH}; } -location ${SEARX_URL_PATH}/static/ { +location ${SEARXNG_URL_PATH}/static/ { alias ${SEARX_SRC}/searx/static/; }