[mod] reduce enviroment variables in shell scripts to what is needed

Not all settings from the 'brand:' section of the YAML files are needed in the
shell scripts.  This patch reduce the variables in ./utils/brand.env to what is
needed.  The following ('brand:' settings) can be removed from this file:

- ISSUE_URL
- DOCS_URL
- PUBLIC_INSTANCES
- WIKI_URL

Tasks running outside of an *installed instance*, need the following settings
from the YAML configuration:

- GIT_URL            <--> brand.git_url
- GIT_BRANCH         <--> brand.git_branch
- SEARX_URL          <--> server.base_url  (aka PUBLIC_URL)
- SEARX_PORT         <--> server.port
- SEARX_BIND_ADDRESS <--> server.bind_address

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-07-20 13:16:21 +02:00
parent 57b8f340a6
commit b6a55e223c
8 changed files with 59 additions and 38 deletions

View file

@ -42,9 +42,6 @@ Global Settings
``brand:`` ``brand:``
------------ ------------
If you change a value in this section, don't forget to rebuild instance's
environment (:ref:`utils/brand.env <make buildenv>`)
.. code:: yaml .. code:: yaml
brand: brand:
@ -55,19 +52,24 @@ environment (:ref:`utils/brand.env <make buildenv>`)
public_instances: https://searx.space public_instances: https://searx.space
wiki_url: https://github.com/searxng/searxng/wiki wiki_url: https://github.com/searxng/searxng/wiki
``git_url`` & ``git_branch`` : :ref:`buildenv GIT_URL & GIT_BRANCH<make buildenv>` .. sidebar:: buildenv
Changing a value tagged by :ref:`buildenv <make buildenv>`, needs to
rebuild instance's environment :ref:`utils/brand.env <make buildenv>`.
``git_url`` & ``git_branch`` : :ref:`buildenv GIT_URL & GIT_BRANCH <make buildenv>`
Changes this, to point to your searx fork (branch). Changes this, to point to your searx fork (branch).
``issue_url`` : :ref:`buildenv ISSUE_URL<make buildenv>` ``issue_url`` :
If you host your own issue tracker change this URL. If you host your own issue tracker change this URL.
``docs_url`` : :ref:`buildenv DOCS_URL<make buildenv>` ``docs_url`` :
If you host your own documentation change this URL. If you host your own documentation change this URL.
``public_instances`` : :ref:`buildenv PUBLIC_INSTANCES<make buildenv>` ``public_instances`` :
If you host your own https://searx.space change this URL. If you host your own https://searx.space change this URL.
``wiki_url`` : :ref:`buildenv WIKI_URL<make buildenv>` ``wiki_url`` :
Link to your wiki (or ``false``) Link to your wiki (or ``false``)
.. _settings global general: .. _settings global general:
@ -98,10 +100,10 @@ environment (:ref:`utils/brand.env <make buildenv>`)
.. code:: yaml .. code:: yaml
server: server:
base_url: false # set custom base_url (or false)
port: 8888 port: 8888
bind_address: "127.0.0.1" # address to listen on bind_address: "127.0.0.1" # address to listen on
secret_key: "ultrasecretkey" # change this! secret_key: "ultrasecretkey" # change this!
base_url: false # set custom base_url (or false)
image_proxy: false # proxying image results through searx image_proxy: false # proxying image results through searx
default_locale: "" # default interface locale default_locale: "" # default interface locale
default_theme: oscar # ui theme default_theme: oscar # ui theme
@ -112,7 +114,17 @@ environment (:ref:`utils/brand.env <make buildenv>`)
X-Robots-Tag : noindex, nofollow X-Robots-Tag : noindex, nofollow
Referrer-Policy : no-referrer Referrer-Policy : no-referrer
``port`` & ``bind_address``: ``$SEARX_PORT`` & ``$SEARX_BIND_ADDRESS`` .. sidebar:: buildenv
Changing a value tagged by :ref:`buildenv <make buildenv>`, needs to
rebuild instance's environment :ref:`utils/brand.env <make buildenv>`.
``base_url`` : :ref:`buildenv SEARX_URL <make buildenv>`
The base URL where searx 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 <make buildenv>`)
``port`` & ``bind_address``: :ref:`buildenv SEARX_PORT & SEARX_BIND_ADDRESS <make buildenv>`
Port number and *bind address* of the searx web application if you run it Port number and *bind address* of the searx web application if you run it
directly using ``python searx/webapp.py``. Doesn't apply to searx running on directly using ``python searx/webapp.py``. Doesn't apply to searx running on
Apache or Nginx. Apache or Nginx.
@ -120,11 +132,6 @@ environment (:ref:`utils/brand.env <make buildenv>`)
``secret_key`` : ``$SEARX_SECRET`` ``secret_key`` : ``$SEARX_SECRET``
Used for cryptography purpose. Used for cryptography purpose.
``base_url`` : :ref:`buildenv SEARX_URL <make buildenv>`
The base URL where searx 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 <make buildenv>`)
``image_proxy`` : ``image_proxy`` :
Allow your instance of searx of being able to proxy images. Uses memory space. Allow your instance of searx of being able to proxy images. Uses memory space.

View file

@ -104,6 +104,16 @@ The ``make buildenv`` target will update the *build environment* in:
- :origin:`utils/brand.env` - :origin:`utils/brand.env`
Tasks running outside of an *installed instance*, need the following settings
from the YAML configuration:
- ``GIT_URL`` from :ref:`brand.git_url <settings global brand>`
- ``GIT_BRANCH`` from :ref:`brand.git_branch <settings global brand>`
- ``SEARX_URL`` from :ref:`server.base_url <settings global server>` (aka
``PUBLIC_URL``)
- ``SEARX_BIND_ADDRESS`` from :ref:`server.bind_address <settings global server>`
- ``SEARX_PORT`` from :ref:`server.port <settings global server>`
.. _make run: .. _make run:

View file

@ -4,15 +4,16 @@ general:
contact_url: false # mailto:contact@example.com contact_url: false # mailto:contact@example.com
brand: brand:
# If you change a value in this section don't forget to rebuild instance's
# enviroment (make buildenv)
git_url: https://github.com/searxng/searxng
git_branch: master
issue_url: https://github.com/searxng/searxng/issues
new_issue_url: https://github.com/searxng/searxng/issues/new new_issue_url: https://github.com/searxng/searxng/issues/new
docs_url: https://searxng.github.io/searxng docs_url: https://searxng.github.io/searxng
public_instances: https://searx.space public_instances: https://searx.space
wiki_url: https://github.com/searxng/searxng/wiki wiki_url: https://github.com/searxng/searxng/wiki
issue_url: https://github.com/searxng/searxng/issues
# If you change a value below don't forget to rebuild instance's enviroment
# (make buildenv)
git_url: https://github.com/searxng/searxng
git_branch: master
search: search:
# Filter results. 0: None, 1: Moderate, 2: Strict # Filter results. 0: None, 1: Moderate, 2: Strict
@ -32,13 +33,14 @@ search:
formats: [html, csv, json, rss] formats: [html, csv, json, rss]
server: server:
# If you change port, bind_address or base_url don't forget to rebuild
# instance's enviroment (make buildenv)
port: 8888 port: 8888
bind_address: "127.0.0.1" bind_address: "127.0.0.1"
base_url: false # Possible values: false or "https://example.org/location".
# Set custom base_url. Possible values: false or "https://example.org/location" # If your instance owns a /etc/searx/settings.yml file, then set the following
# If you change base_url don't forget to rebuild instance's enviroment (make # values there.
# buildenv) port & address to listen on
base_url: false
secret_key: "ultrasecretkey" # change this! secret_key: "ultrasecretkey" # change this!
# Proxying image results through searx # Proxying image results through searx

View file

@ -1,7 +1,5 @@
export SEARX_URL=''
export GIT_URL='https://github.com/searxng/searxng' export GIT_URL='https://github.com/searxng/searxng'
export GIT_BRANCH='master' export GIT_BRANCH='master'
export ISSUE_URL='https://github.com/searxng/searxng/issues' export SEARX_URL=''
export DOCS_URL='https://searxng.github.io/searxng' export SEARX_PORT='8888'
export PUBLIC_INSTANCES='https://searx.space' export SEARX_BIND_ADDRESS='127.0.0.1'
export WIKI_URL='https://github.com/searxng/searxng/wiki'

View file

@ -23,14 +23,19 @@ def _env(*arg, **kwargs):
val = '' val = ''
return val return val
# If you add or remove variables here, do not forgett to update:
# - docs/admin/engines/settings.rst
# - /docs/dev/makefile.rst (section make buildenv)
name_val = [ name_val = [
('SEARX_URL' , 'server.base_url'),
('GIT_URL' , 'brand.git_url'), ('GIT_URL' , 'brand.git_url'),
('GIT_BRANCH' , 'brand.git_branch'), ('GIT_BRANCH' , 'brand.git_branch'),
('ISSUE_URL' , 'brand.issue_url'),
('DOCS_URL' , 'brand.docs_url'), ('SEARX_URL' , 'server.base_url'),
('PUBLIC_INSTANCES' , 'brand.public_instances'), ('SEARX_PORT' , 'server.port'),
('WIKI_URL' , 'brand.wiki_url'), ('SEARX_BIND_ADDRESS' , 'server.bind_address'),
] ]
brand_env = 'utils' + sep + 'brand.env' brand_env = 'utils' + sep + 'brand.env'

View file

@ -568,7 +568,7 @@ check_connectivity() {
info_msg "Most often the connectivity is blocked by a docker installation:" info_msg "Most often the connectivity is blocked by a docker installation:"
info_msg "Whenever docker is started (reboot) it sets the iptables policy " info_msg "Whenever docker is started (reboot) it sets the iptables policy "
info_msg "for the FORWARD chain to DROP, see:" info_msg "for the FORWARD chain to DROP, see:"
info_msg " ${DOCS_URL}/utils/lxc.sh.html#internet-connectivity-docker" info_msg " https://searxng.github.io/searxng/utils/lxc.sh.html#internet-connectivity-docker"
iptables-save | grep ":FORWARD" iptables-save | grep ":FORWARD"
fi fi
return $ret_val return $ret_val

View file

@ -12,7 +12,6 @@ source "${REPO_ROOT}/utils/lib_install.sh"
MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}" MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty/}" PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty/}"
PUBLIC_URL_MORTY="${PUBLIC_URL_MORTY:-$(echo "$PUBLIC_URL" | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}}" PUBLIC_URL_MORTY="${PUBLIC_URL_MORTY:-$(echo "$PUBLIC_URL" | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}}"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
@ -111,7 +110,7 @@ info_searx() {
# shellcheck disable=SC1117 # shellcheck disable=SC1117
cat <<EOF cat <<EOF
To activate result and image proxy in SearXNG read: To activate result and image proxy in SearXNG read:
${DOCS_URL}/admin/morty.html https://searxng.github.io/searxng/admin/morty.html
Check settings in file ${SEARX_SETTINGS_PATH} ... Check settings in file ${SEARX_SETTINGS_PATH} ...
result_proxy: result_proxy:
url : ${PUBLIC_URL_MORTY} url : ${PUBLIC_URL_MORTY}

View file

@ -1,6 +1,6 @@
# SearXNG settings, before editing this file read: # SearXNG settings, before editing this file read:
# #
# ${DOCS_URL}/admin/engines/settings.html # https://searxng.github.io/searxng/admin/engines/settings.html
use_default_settings: true use_default_settings: true