diff --git a/.config.sh b/.config.sh index 0e41a73b..36066139 100644 --- a/.config.sh +++ b/.config.sh @@ -17,14 +17,14 @@ # -------------- # The setup of the SearXNG instance is done in the settings.yml -# (SEARX_SETTINGS_PATH). Read the remarks in [1] carefully and don't forget to +# (SEARXNG_SETTINGS_PATH). Read the remarks in [1] carefully and don't forget to # rebuild instance's environment (make buildenv) if needed. The settings.yml # file of an already installed instance is shown by:: # # $ ./utils/searx.sh --help # ---- SearXNG instance setup (already installed) -# SEARX_SETTINGS_PATH : /etc/searx/settings.yml -# SEARX_SRC : /usr/local/searx/searx-src +# SEARXNG_SETTINGS_PATH : /etc/searx/settings.yml +# SEARX_SRC : /usr/local/searx/searx-src # # [1] https://searxng.github.io/searxng/admin/engines/settings.html diff --git a/Dockerfile b/Dockerfile index a05adaf4..df83f8ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ ENV INSTANCE_NAME=searxng \ BASE_URL= \ MORTY_KEY= \ MORTY_URL= \ - SEARX_SETTINGS_PATH=/etc/searx/settings.yml \ + SEARXNG_SETTINGS_PATH=/etc/searx/settings.yml \ UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini WORKDIR /usr/local/searx diff --git a/dockerfiles/docker-entrypoint.sh b/dockerfiles/docker-entrypoint.sh index d5c4d5fe..c69ed621 100755 --- a/dockerfiles/docker-entrypoint.sh +++ b/dockerfiles/docker-entrypoint.sh @@ -132,7 +132,7 @@ update_conf() { update_conf "${FORCE_CONF_UPDATE}" "${UWSGI_SETTINGS_PATH}" "/usr/local/searx/dockerfiles/uwsgi.ini" "patch_uwsgi_settings" # make sure there are searx settings -update_conf "${FORCE_CONF_UPDATE}" "${SEARX_SETTINGS_PATH}" "/usr/local/searx/searx/settings.yml" "patch_searx_settings" +update_conf "${FORCE_CONF_UPDATE}" "${SEARXNG_SETTINGS_PATH}" "/usr/local/searx/searx/settings.yml" "patch_searx_settings" # dry run (to update configuration files, then inspect them) if [ $DRY_RUN -eq 1 ]; then diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst index 8c23bb9b..6a325635 100644 --- a/docs/admin/engines/settings.rst +++ b/docs/admin/engines/settings.rst @@ -24,7 +24,7 @@ settings.yml location The initial ``settings.yml`` we be load from these locations: -1. the full path specified in the ``SEARX_SETTINGS_PATH`` environment variable. +1. the full path specified in the ``SEARXNG_SETTINGS_PATH`` environment variable. 2. ``/etc/searx/settings.yml`` If these files don't exist (or are empty or can't be read), SearXNG uses the diff --git a/docs/admin/installation-searx.rst b/docs/admin/installation-searx.rst index 9e9157b8..cb3cf9f0 100644 --- a/docs/admin/installation-searx.rst +++ b/docs/admin/installation-searx.rst @@ -107,7 +107,7 @@ Check ===== To check your SearXNG setup, optional enable debugging and start the *webapp*. -SearXNG looks at the exported environment ``$SEARX_SETTINGS_PATH`` for a +SearXNG looks at the exported environment ``$SEARXNG_SETTINGS_PATH`` for a configuration file. .. kernel-include:: $DOCS_BUILD/includes/searx.rst diff --git a/docs/build-templates/searx.rst b/docs/build-templates/searx.rst index 70e658b4..804514ac 100644 --- a/docs/build-templates/searx.rst +++ b/docs/build-templates/searx.rst @@ -133,17 +133,17 @@ ${fedora_build} .. code-block:: sh - $ sudo -H mkdir -p \"$(dirname ${SEARX_SETTINGS_PATH})\" + $ sudo -H mkdir -p \"$(dirname ${SEARXNG_SETTINGS_PATH})\" $ sudo -H cp \"$SEARX_SRC/utils/templates/etc/searx/settings.yml\" \\ - \"${SEARX_SETTINGS_PATH}\" + \"${SEARXNG_SETTINGS_PATH}\" .. group-tab:: searx/settings.yml .. code-block:: sh - $ sudo -H mkdir -p \"$(dirname ${SEARX_SETTINGS_PATH})\" + $ sudo -H mkdir -p \"$(dirname ${SEARXNG_SETTINGS_PATH})\" $ sudo -H cp \"$SEARX_SRC/searx/settings.yml\" \\ - \"${SEARX_SETTINGS_PATH}\" + \"${SEARXNG_SETTINGS_PATH}\" .. tabs:: @@ -151,7 +151,7 @@ ${fedora_build} .. code-block:: sh - $ sudo -H sed -i -e \"s/ultrasecretkey/\$(openssl rand -hex 16)/g\" \"$SEARX_SETTINGS_PATH\" + $ sudo -H sed -i -e \"s/ultrasecretkey/\$(openssl rand -hex 16)/g\" \"$SEARXNG_SETTINGS_PATH\" .. END searx config @@ -164,16 +164,16 @@ ${fedora_build} .. code-block:: sh # enable debug .. - $ sudo -H sed -i -e \"s/debug : False/debug : True/g\" \"$SEARX_SETTINGS_PATH\" + $ sudo -H sed -i -e \"s/debug : False/debug : True/g\" \"$SEARXNG_SETTINGS_PATH\" # start webapp $ sudo -H -u ${SERVICE_USER} -i (${SERVICE_USER})$ cd ${SEARX_SRC} - (${SERVICE_USER})$ export SEARX_SETTINGS_PATH=\"${SEARX_SETTINGS_PATH}\" + (${SERVICE_USER})$ export SEARXNG_SETTINGS_PATH=\"${SEARXNG_SETTINGS_PATH}\" (${SERVICE_USER})$ python searx/webapp.py # disable debug - $ sudo -H sed -i -e \"s/debug : True/debug : False/g\" \"$SEARX_SETTINGS_PATH\" + $ sudo -H sed -i -e \"s/debug : True/debug : False/g\" \"$SEARXNG_SETTINGS_PATH\" Open WEB browser and visit http://$SEARX_INTERNAL_HTTP . If you are inside a container or in a script, test with curl: diff --git a/docs/dev/lxcdev.rst b/docs/dev/lxcdev.rst index 9d550305..12f6d787 100644 --- a/docs/dev/lxcdev.rst +++ b/docs/dev/lxcdev.rst @@ -288,7 +288,7 @@ The uWSGI-App for the archlinux dsitros is configured in least you should attend the settings of ``uid``, ``chdir``, ``env`` and ``http``:: - env = SEARX_SETTINGS_PATH=/etc/searx/settings.yml + env = SEARXNG_SETTINGS_PATH=/etc/searx/settings.yml http = 127.0.0.1:8888 chdir = /usr/local/searx/searx-src/searx diff --git a/manage b/manage index 553d3f20..b02128df 100755 --- a/manage +++ b/manage @@ -105,14 +105,14 @@ export DOCS_BUILD buildenv() { # settings file from repository's working tree are used by default - SEARX_SETTINGS_PATH="${REPO_ROOT}/searx/settings.yml" + SEARXNG_SETTINGS_PATH="${REPO_ROOT}/searx/settings.yml" if [ -r '/etc/searx/settings.yml' ]; then if ask_yn "should settings read from: /etc/searx/settings.yml"; then - SEARX_SETTINGS_PATH='/etc/searx/settings.yml' + SEARXNG_SETTINGS_PATH='/etc/searx/settings.yml' fi fi - export SEARX_SETTINGS_PATH + export SEARXNG_SETTINGS_PATH ( set -e SEARXNG_DEBUG=1 pyenv.cmd python utils/build_env.py 2>&1 \ diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index 8266c675..d1c97ec8 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -2,5 +2,5 @@ import os from os.path import dirname, sep, abspath # In unit tests the user settings from unit/settings/test_settings.yml are used. -os.environ['SEARX_SETTINGS_PATH'] = abspath( +os.environ['SEARXNG_SETTINGS_PATH'] = abspath( dirname(__file__) + sep + 'settings' + sep + 'test_settings.yml') diff --git a/tests/unit/test_settings_loader.py b/tests/unit/test_settings_loader.py index ad9fc6e9..9e04df65 100644 --- a/tests/unit/test_settings_loader.py +++ b/tests/unit/test_settings_loader.py @@ -58,14 +58,14 @@ class TestUserSettings(SearxTestCase): def test_user_settings_not_found(self): with patch.dict(settings_loader.environ, - {'SEARX_SETTINGS_PATH': '/dev/null'}): + {'SEARXNG_SETTINGS_PATH': '/dev/null'}): settings, msg = settings_loader.load_settings() self.assertTrue(msg.startswith('load the default settings from')) self.assertEqual(settings['server']['secret_key'], "ultrasecretkey") def test_user_settings(self): with patch.dict(settings_loader.environ, - {'SEARX_SETTINGS_PATH': join(test_dir, 'settings/user_settings_simple.yml')}): + {'SEARXNG_SETTINGS_PATH': join(test_dir, 'settings/user_settings_simple.yml')}): settings, msg = settings_loader.load_settings() self.assertTrue(msg.startswith('merge the default settings')) self.assertEqual(settings['server']['secret_key'], "user_secret_key") @@ -73,7 +73,7 @@ class TestUserSettings(SearxTestCase): def test_user_settings_remove(self): with patch.dict(settings_loader.environ, - {'SEARX_SETTINGS_PATH': join(test_dir, 'settings/user_settings_remove.yml')}): + {'SEARXNG_SETTINGS_PATH': join(test_dir, 'settings/user_settings_remove.yml')}): settings, msg = settings_loader.load_settings() self.assertTrue(msg.startswith('merge the default settings')) self.assertEqual(settings['server']['secret_key'], "user_secret_key") @@ -85,7 +85,7 @@ class TestUserSettings(SearxTestCase): def test_user_settings_remove2(self): with patch.dict(settings_loader.environ, - {'SEARX_SETTINGS_PATH': join(test_dir, 'settings/user_settings_remove2.yml')}): + {'SEARXNG_SETTINGS_PATH': join(test_dir, 'settings/user_settings_remove2.yml')}): settings, msg = settings_loader.load_settings() self.assertTrue(msg.startswith('merge the default settings')) self.assertEqual(settings['server']['secret_key'], "user_secret_key") @@ -102,7 +102,7 @@ class TestUserSettings(SearxTestCase): def test_user_settings_keep_only(self): with patch.dict(settings_loader.environ, - {'SEARX_SETTINGS_PATH': join(test_dir, 'settings/user_settings_keep_only.yml')}): + {'SEARXNG_SETTINGS_PATH': join(test_dir, 'settings/user_settings_keep_only.yml')}): settings, msg = settings_loader.load_settings() self.assertTrue(msg.startswith('merge the default settings')) engine_names = [engine['name'] for engine in settings['engines']] @@ -112,7 +112,7 @@ class TestUserSettings(SearxTestCase): def test_custom_settings(self): with patch.dict(settings_loader.environ, - {'SEARX_SETTINGS_PATH': join(test_dir, 'settings/user_settings.yml')}): + {'SEARXNG_SETTINGS_PATH': join(test_dir, 'settings/user_settings.yml')}): settings, msg = settings_loader.load_settings() self.assertTrue(msg.startswith('load the user settings from')) self.assertEqual(settings['server']['port'], 9000) diff --git a/utils/build_env.py b/utils/build_env.py index 3ba4e4aa..42d75fbf 100644 --- a/utils/build_env.py +++ b/utils/build_env.py @@ -12,7 +12,7 @@ sys.path.insert(0, repo_root) # Assure that the settings file from reposetorie's working tree is used to # generate the build_env, not from /etc/searx/settings.yml. -os.environ['SEARX_SETTINGS_PATH'] = join(repo_root, 'etc', 'settings.yml') +os.environ['SEARXNG_SETTINGS_PATH'] = join(repo_root, 'etc', 'settings.yml') def _env(*arg, **kwargs): val = get_setting(*arg, **kwargs) @@ -51,7 +51,7 @@ for name, option in name_val: from searx.version import GIT_URL, GIT_BRANCH from searx import get_setting -print('build %s (settings from: %s)' % (brand_env, os.environ['SEARX_SETTINGS_PATH'])) +print('build %s (settings from: %s)' % (brand_env, os.environ['SEARXNG_SETTINGS_PATH'])) sys.path.insert(0, repo_root) with open(repo_root + sep + brand_env, 'w', encoding='utf-8') as f: diff --git a/utils/lib_install.sh b/utils/lib_install.sh index 4ad11d63..dc9ee699 100755 --- a/utils/lib_install.sh +++ b/utils/lib_install.sh @@ -53,7 +53,7 @@ source_dot_config() { export eval_SEARX_SRC='true' SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) SEARX_PYENV=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_PYENV) - SEARX_SETTINGS_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SETTINGS_PATH) + SEARXNG_SETTINGS_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_SETTINGS_PATH) if [ ! -r "${SEARX_SRC}" ]; then info_msg "not yet cloned: ${SEARX_SRC}" orig_source_dot_config @@ -115,7 +115,7 @@ init_SEARX_SRC_INIT_FILES(){ install_log_searx_instance() { echo -e "---- SearXNG instance setup ${_BBlue}(status: $(install_searx_get_state))${_creset}" - echo -e " SEARX_SETTINGS_PATH : ${_BBlue}${SEARX_SETTINGS_PATH}${_creset}" + echo -e " SEARXNG_SETTINGS_PATH : ${_BBlue}${SEARXNG_SETTINGS_PATH}${_creset}" echo -e " SSEARX_PYENV : ${_BBlue}${SEARX_PYENV}${_creset}" echo -e " SEARX_SRC : ${_BBlue}${SEARX_SRC:-none}${_creset}" echo -e " SEARX_URL : ${_BBlue}${SEARX_URL:-none}${_creset}" @@ -163,7 +163,7 @@ install_searx_get_state(){ echo "missing-searx-pyenv" return fi - if ! [ -r "${SEARX_SETTINGS_PATH}" ]; then + if ! [ -r "${SEARXNG_SETTINGS_PATH}" ]; then echo "missing-settings" return fi diff --git a/utils/morty.sh b/utils/morty.sh index c3956867..0c5401ee 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -111,7 +111,7 @@ info_searx() { cat <&1 | prefix_stdout "$_service_prefix" cd ${SEARX_SRC} -sed -i -e "s/ultrasecretkey/$(openssl rand -hex 16)/g" "$SEARX_SETTINGS_PATH" +sed -i -e "s/ultrasecretkey/$(openssl rand -hex 16)/g" "$SEARXNG_SETTINGS_PATH" EOF } @@ -711,15 +711,15 @@ test_local_searx() { return fi fi - sed -i -e "s/debug: false/debug: true/g" "$SEARX_SETTINGS_PATH" + sed -i -e "s/debug: false/debug: true/g" "$SEARXNG_SETTINGS_PATH" tee_stderr 0.1 <&1 | prefix_stdout "$_service_prefix" -export SEARX_SETTINGS_PATH="${SEARX_SETTINGS_PATH}" +export SEARXNG_SETTINGS_PATH="${SEARXNG_SETTINGS_PATH}" cd ${SEARX_SRC} timeout 10 python searx/webapp.py & sleep 3 curl --location --verbose --head --insecure $SEARX_INTERNAL_HTTP EOF - sed -i -e "s/debug: true/debug: false/g" "$SEARX_SETTINGS_PATH" + sed -i -e "s/debug: true/debug: false/g" "$SEARXNG_SETTINGS_PATH" } install_searx_uwsgi() { @@ -753,7 +753,7 @@ enable_image_proxy() { info_msg "try to enable image_proxy ..." tee_stderr 0.1 <&1 | prefix_stdout "$_service_prefix" cd ${SEARX_SRC} -sed -i -e "s/image_proxy: false/image_proxy: true/g" "$SEARX_SETTINGS_PATH" +sed -i -e "s/image_proxy: false/image_proxy: true/g" "$SEARXNG_SETTINGS_PATH" EOF uWSGI_restart "$SEARX_UWSGI_APP" } @@ -762,7 +762,7 @@ disable_image_proxy() { info_msg "try to enable image_proxy ..." tee_stderr 0.1 <&1 | prefix_stdout "$_service_prefix" cd ${SEARX_SRC} -sed -i -e "s/image_proxy: true/image_proxy: false/g" "$SEARX_SETTINGS_PATH" +sed -i -e "s/image_proxy: true/image_proxy: false/g" "$SEARXNG_SETTINGS_PATH" EOF uWSGI_restart "$SEARX_UWSGI_APP" } @@ -772,7 +772,7 @@ enable_debug() { info_msg "try to enable debug mode ..." tee_stderr 0.1 <&1 | prefix_stdout "$_service_prefix" cd ${SEARX_SRC} -sed -i -e "s/debug: false/debug: true/g" "$SEARX_SETTINGS_PATH" +sed -i -e "s/debug: false/debug: true/g" "$SEARXNG_SETTINGS_PATH" EOF uWSGI_restart "$SEARX_UWSGI_APP" } @@ -781,7 +781,7 @@ disable_debug() { info_msg "try to disable debug mode ..." tee_stderr 0.1 <&1 | prefix_stdout "$_service_prefix" cd ${SEARX_SRC} -sed -i -e "s/debug: true/debug: false/g" "$SEARX_SETTINGS_PATH" +sed -i -e "s/debug: true/debug: false/g" "$SEARXNG_SETTINGS_PATH" EOF uWSGI_restart "$SEARX_UWSGI_APP" } @@ -791,8 +791,8 @@ set_result_proxy() { # usage: set_result_proxy [] info_msg "try to set result proxy: '$1' ($2)" - cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak" - _set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}" + cp "${SEARXNG_SETTINGS_PATH}" "${SEARXNG_SETTINGS_PATH}.bak" + _set_result_proxy "$1" "$2" > "${SEARXNG_SETTINGS_PATH}" } _set_result_proxy() { @@ -829,7 +829,7 @@ _set_result_proxy() { fi fi echo "$line" - done < "${SEARX_SETTINGS_PATH}.bak" + done < "${SEARXNG_SETTINGS_PATH}.bak" } function has_substring() { diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini index 71cece3c..dcb7d1a7 100644 --- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini +++ b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini @@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8 chdir = ${SEARX_SRC}/searx # searx configuration (settings.yml) -env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} # disable logging for privacy logger = systemd diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket index 1a0fda91..58060007 100644 --- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket +++ b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket @@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8 chdir = ${SEARX_SRC}/searx # searx configuration (settings.yml) -env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} # disable logging for privacy logger = systemd diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini b/utils/templates/etc/uwsgi/apps-available/searx.ini index 45214ef1..440c2e97 100644 --- a/utils/templates/etc/uwsgi/apps-available/searx.ini +++ b/utils/templates/etc/uwsgi/apps-available/searx.ini @@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8 chdir = ${SEARX_SRC}/searx # searx configuration (settings.yml) -env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} # disable logging for privacy disable-logging = true diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket b/utils/templates/etc/uwsgi/apps-available/searx.ini:socket index 9cb29210..08c98cf6 100644 --- a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket +++ b/utils/templates/etc/uwsgi/apps-available/searx.ini:socket @@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8 chdir = ${SEARX_SRC}/searx # searx configuration (settings.yml) -env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} # disable logging for privacy disable-logging = true