[brand] SearXNG - bash env SEARXNG_URL

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-10-11 19:59:34 +02:00
parent 68effd5eda
commit a9fc4885f2
11 changed files with 22 additions and 22 deletions

View file

@ -109,7 +109,7 @@ Global Settings
Changing a value tagged by :ref:`buildenv <make buildenv>`, needs to Changing a value tagged by :ref:`buildenv <make buildenv>`, needs to
rebuild instance's environment :ref:`utils/brand.env <make buildenv>`. rebuild instance's environment :ref:`utils/brand.env <make buildenv>`.
``base_url`` : :ref:`buildenv SEARX_URL <make buildenv>` ``base_url`` : :ref:`buildenv SEARXNG_URL <make buildenv>`
The base URL where SearXNG is deployed. Used to create correct inbound links. 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 If you change the value, don't forget to rebuild instance's environment
(:ref:`utils/brand.env <make buildenv>`) (:ref:`utils/brand.env <make buildenv>`)

View file

@ -14,7 +14,7 @@ copyright = '2021 SearXNG team, 2015-2021 Adam Tauber, Noémi Ványi'
author = '2021 SearXNG team, 2015-2021 Adam Tauber' author = '2021 SearXNG team, 2015-2021 Adam Tauber'
release, version = VERSION_STRING, VERSION_STRING 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') ISSUE_URL = get_setting('brand.issue_url')
DOCS_URL = get_setting('brand.docs_url') DOCS_URL = get_setting('brand.docs_url')
PUBLIC_INSTANCES = get_setting('brand.public_instances') 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 # links to custom brand
extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://') extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://')
extlinks['patch'] = (GIT_URL + '/commit/%s', '#') extlinks['patch'] = (GIT_URL + '/commit/%s', '#')
extlinks['search'] = (SEARX_URL + '/%s', '#') extlinks['search'] = (SEARXNG_URL + '/%s', '#')
extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ') extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ')
extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ') extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ')
extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '') extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '')

View file

@ -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 Tasks running outside of an *installed instance*, need the following settings
from the YAML configuration: from the YAML configuration:
- ``SEARX_URL`` from :ref:`server.base_url <settings global server>` (aka - ``SEARXNG_URL`` from :ref:`server.base_url <settings global server>` (aka
``PUBLIC_URL``) ``PUBLIC_URL``)
- ``SEARXNG_BIND_ADDRESS`` from :ref:`server.bind_address <settings global server>` - ``SEARXNG_BIND_ADDRESS`` from :ref:`server.bind_address <settings global server>`
- ``SEARXNG_PORT`` from :ref:`server.port <settings global server>` - ``SEARXNG_PORT`` from :ref:`server.port <settings global server>`

View file

@ -1,4 +1,4 @@
export SEARX_URL='' export SEARXNG_URL=''
export SEARXNG_PORT='8888' export SEARXNG_PORT='8888'
export SEARXNG_BIND_ADDRESS='127.0.0.1' export SEARXNG_BIND_ADDRESS='127.0.0.1'
export GIT_URL='https://github.com/searxng/searxng' export GIT_URL='https://github.com/searxng/searxng'

View file

@ -28,7 +28,7 @@ def _env(*arg, **kwargs):
name_val = [ name_val = [
('SEARX_URL' , 'server.base_url'), ('SEARXNG_URL' , 'server.base_url'),
('SEARXNG_PORT' , 'server.port'), ('SEARXNG_PORT' , 'server.port'),
('SEARXNG_BIND_ADDRESS' , 'server.bind_address'), ('SEARXNG_BIND_ADDRESS' , 'server.bind_address'),

View file

@ -560,7 +560,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE}
# shellcheck disable=SC2034 # shellcheck disable=SC2034
SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
# shellcheck disable=SC2034 # 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}" nginx_install_app --variant=filtron "${NGINX_FILTRON_SITE}"
info_msg "testing public url .." info_msg "testing public url .."

View file

@ -116,9 +116,9 @@ install_log_searx_instance() {
echo -e "---- SearXNG instance setup ${_BBlue}(status: $(install_searx_get_state))${_creset}" echo -e "---- SearXNG instance setup ${_BBlue}(status: $(install_searx_get_state))${_creset}"
echo -e " SEARXNG_SETTINGS_PATH : ${_BBlue}${SEARXNG_SETTINGS_PATH}${_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_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 if in_container; then
# searx is listening on 127.0.0.1 and not available from outside container # 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 # shellcheck source=utils/brand.env
source "${REPO_ROOT}/utils/brand.env" source "${REPO_ROOT}/utils/brand.env"
# SEARX_URL aka PUBLIC_URL: the public URL of the instance (e.g. # SEARXNG_URL aka PUBLIC_URL: the public URL of the instance (e.g.
# "https://example.org/searx"). The value is taken from environment $SEARX_URL # "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 # in ./utils/brand.env. This variable is a empty string if server.base_url in
# the settings.yml is set to 'false'. # 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 if in_container; then
# hint: Linux containers do not have DNS entries, lets use IPs # hint: Linux containers do not have DNS entries, lets use IPs
SEARX_URL="http://$(primary_ip)" SEARXNG_URL="http://$(primary_ip)"
fi fi
PUBLIC_URL="${SEARX_URL}" PUBLIC_URL="${SEARXNG_URL}"
source_dot_config source_dot_config

View file

@ -513,7 +513,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_MORTY_SITE})"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
# shellcheck disable=SC2034 # 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}" nginx_install_app "${NGINX_MORTY_SITE}"
info_msg "testing public url .." info_msg "testing public url .."

View file

@ -14,9 +14,9 @@ source "${REPO_ROOT}/utils/lib_install.sh"
SEARX_INTERNAL_HTTP="${SEARXNG_BIND_ADDRESS}:${SEARXNG_PORT}" 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')}" | 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_NAME="searx"
SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}" SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}"

View file

@ -5,10 +5,10 @@ LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so
LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so
# LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.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 # CustomLog /dev/null combined env=dontlog
<Location ${SEARX_URL_PATH}> <Location ${SEARXNG_URL_PATH}>
<IfModule mod_security2.c> <IfModule mod_security2.c>
SecRuleEngine Off SecRuleEngine Off

View file

@ -1,6 +1,6 @@
# https://example.org/searx # https://example.org/searx
location ${SEARX_URL_PATH} { location ${SEARXNG_URL_PATH} {
proxy_pass http://127.0.0.1:4004/; proxy_pass http://127.0.0.1:4004/;
proxy_set_header Host \$host; 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-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Scheme \$scheme; 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/; alias ${SEARX_SRC}/searx/static/;
} }