SearXNG: SEARXNG_SETTINGS_PATH

This commit is contained in:
Alexandre Flament 2021-10-02 17:18:05 +02:00
parent 9e266ecad3
commit 253b850376
18 changed files with 56 additions and 56 deletions

View file

@ -17,13 +17,13 @@
# -------------- # --------------
# The setup of the SearXNG instance is done in the settings.yml # 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 # rebuild instance's environment (make buildenv) if needed. The settings.yml
# file of an already installed instance is shown by:: # file of an already installed instance is shown by::
# #
# $ ./utils/searx.sh --help # $ ./utils/searx.sh --help
# ---- SearXNG instance setup (already installed) # ---- SearXNG instance setup (already installed)
# SEARX_SETTINGS_PATH : /etc/searx/settings.yml # SEARXNG_SETTINGS_PATH : /etc/searx/settings.yml
# SEARX_SRC : /usr/local/searx/searx-src # SEARX_SRC : /usr/local/searx/searx-src
# #
# [1] https://searxng.github.io/searxng/admin/engines/settings.html # [1] https://searxng.github.io/searxng/admin/engines/settings.html

View file

@ -15,7 +15,7 @@ ENV INSTANCE_NAME=searxng \
BASE_URL= \ BASE_URL= \
MORTY_KEY= \ MORTY_KEY= \
MORTY_URL= \ MORTY_URL= \
SEARX_SETTINGS_PATH=/etc/searx/settings.yml \ SEARXNG_SETTINGS_PATH=/etc/searx/settings.yml \
UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
WORKDIR /usr/local/searx WORKDIR /usr/local/searx

View file

@ -132,7 +132,7 @@ update_conf() {
update_conf "${FORCE_CONF_UPDATE}" "${UWSGI_SETTINGS_PATH}" "/usr/local/searx/dockerfiles/uwsgi.ini" "patch_uwsgi_settings" update_conf "${FORCE_CONF_UPDATE}" "${UWSGI_SETTINGS_PATH}" "/usr/local/searx/dockerfiles/uwsgi.ini" "patch_uwsgi_settings"
# make sure there are searx 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) # dry run (to update configuration files, then inspect them)
if [ $DRY_RUN -eq 1 ]; then if [ $DRY_RUN -eq 1 ]; then

View file

@ -24,7 +24,7 @@ settings.yml location
The initial ``settings.yml`` we be load from these locations: 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`` 2. ``/etc/searx/settings.yml``
If these files don't exist (or are empty or can't be read), SearXNG uses the If these files don't exist (or are empty or can't be read), SearXNG uses the

View file

@ -107,7 +107,7 @@ Check
===== =====
To check your SearXNG setup, optional enable debugging and start the *webapp*. 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. configuration file.
.. kernel-include:: $DOCS_BUILD/includes/searx.rst .. kernel-include:: $DOCS_BUILD/includes/searx.rst

View file

@ -133,17 +133,17 @@ ${fedora_build}
.. code-block:: sh .. 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\" \\ $ sudo -H cp \"$SEARX_SRC/utils/templates/etc/searx/settings.yml\" \\
\"${SEARX_SETTINGS_PATH}\" \"${SEARXNG_SETTINGS_PATH}\"
.. group-tab:: searx/settings.yml .. group-tab:: searx/settings.yml
.. code-block:: sh .. 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\" \\ $ sudo -H cp \"$SEARX_SRC/searx/settings.yml\" \\
\"${SEARX_SETTINGS_PATH}\" \"${SEARXNG_SETTINGS_PATH}\"
.. tabs:: .. tabs::
@ -151,7 +151,7 @@ ${fedora_build}
.. code-block:: sh .. 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 .. END searx config
@ -164,16 +164,16 @@ ${fedora_build}
.. code-block:: sh .. code-block:: sh
# enable debug .. # 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 # start webapp
$ sudo -H -u ${SERVICE_USER} -i $ sudo -H -u ${SERVICE_USER} -i
(${SERVICE_USER})$ cd ${SEARX_SRC} (${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 (${SERVICE_USER})$ python searx/webapp.py
# disable debug # 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 Open WEB browser and visit http://$SEARX_INTERNAL_HTTP . If you are inside a
container or in a script, test with curl: container or in a script, test with curl:

View file

@ -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 least you should attend the settings of ``uid``, ``chdir``, ``env`` and
``http``:: ``http``::
env = SEARX_SETTINGS_PATH=/etc/searx/settings.yml env = SEARXNG_SETTINGS_PATH=/etc/searx/settings.yml
http = 127.0.0.1:8888 http = 127.0.0.1:8888
chdir = /usr/local/searx/searx-src/searx chdir = /usr/local/searx/searx-src/searx

6
manage
View file

@ -105,14 +105,14 @@ export DOCS_BUILD
buildenv() { buildenv() {
# settings file from repository's working tree are used by default # 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 [ -r '/etc/searx/settings.yml' ]; then
if ask_yn "should settings read from: /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
fi fi
export SEARX_SETTINGS_PATH export SEARXNG_SETTINGS_PATH
( (
set -e set -e
SEARXNG_DEBUG=1 pyenv.cmd python utils/build_env.py 2>&1 \ SEARXNG_DEBUG=1 pyenv.cmd python utils/build_env.py 2>&1 \

View file

@ -2,5 +2,5 @@ import os
from os.path import dirname, sep, abspath from os.path import dirname, sep, abspath
# In unit tests the user settings from unit/settings/test_settings.yml are used. # 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') dirname(__file__) + sep + 'settings' + sep + 'test_settings.yml')

View file

@ -58,14 +58,14 @@ class TestUserSettings(SearxTestCase):
def test_user_settings_not_found(self): def test_user_settings_not_found(self):
with patch.dict(settings_loader.environ, with patch.dict(settings_loader.environ,
{'SEARX_SETTINGS_PATH': '/dev/null'}): {'SEARXNG_SETTINGS_PATH': '/dev/null'}):
settings, msg = settings_loader.load_settings() settings, msg = settings_loader.load_settings()
self.assertTrue(msg.startswith('load the default settings from')) self.assertTrue(msg.startswith('load the default settings from'))
self.assertEqual(settings['server']['secret_key'], "ultrasecretkey") self.assertEqual(settings['server']['secret_key'], "ultrasecretkey")
def test_user_settings(self): def test_user_settings(self):
with patch.dict(settings_loader.environ, 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() settings, msg = settings_loader.load_settings()
self.assertTrue(msg.startswith('merge the default settings')) self.assertTrue(msg.startswith('merge the default settings'))
self.assertEqual(settings['server']['secret_key'], "user_secret_key") self.assertEqual(settings['server']['secret_key'], "user_secret_key")
@ -73,7 +73,7 @@ class TestUserSettings(SearxTestCase):
def test_user_settings_remove(self): def test_user_settings_remove(self):
with patch.dict(settings_loader.environ, 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() settings, msg = settings_loader.load_settings()
self.assertTrue(msg.startswith('merge the default settings')) self.assertTrue(msg.startswith('merge the default settings'))
self.assertEqual(settings['server']['secret_key'], "user_secret_key") self.assertEqual(settings['server']['secret_key'], "user_secret_key")
@ -85,7 +85,7 @@ class TestUserSettings(SearxTestCase):
def test_user_settings_remove2(self): def test_user_settings_remove2(self):
with patch.dict(settings_loader.environ, 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() settings, msg = settings_loader.load_settings()
self.assertTrue(msg.startswith('merge the default settings')) self.assertTrue(msg.startswith('merge the default settings'))
self.assertEqual(settings['server']['secret_key'], "user_secret_key") self.assertEqual(settings['server']['secret_key'], "user_secret_key")
@ -102,7 +102,7 @@ class TestUserSettings(SearxTestCase):
def test_user_settings_keep_only(self): def test_user_settings_keep_only(self):
with patch.dict(settings_loader.environ, 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() settings, msg = settings_loader.load_settings()
self.assertTrue(msg.startswith('merge the default settings')) self.assertTrue(msg.startswith('merge the default settings'))
engine_names = [engine['name'] for engine in settings['engines']] engine_names = [engine['name'] for engine in settings['engines']]
@ -112,7 +112,7 @@ class TestUserSettings(SearxTestCase):
def test_custom_settings(self): def test_custom_settings(self):
with patch.dict(settings_loader.environ, 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() settings, msg = settings_loader.load_settings()
self.assertTrue(msg.startswith('load the user settings from')) self.assertTrue(msg.startswith('load the user settings from'))
self.assertEqual(settings['server']['port'], 9000) self.assertEqual(settings['server']['port'], 9000)

View file

@ -12,7 +12,7 @@ sys.path.insert(0, repo_root)
# Assure that the settings file from reposetorie's working tree is used to # Assure that the settings file from reposetorie's working tree is used to
# generate the build_env, not from /etc/searx/settings.yml. # 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): def _env(*arg, **kwargs):
val = get_setting(*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.version import GIT_URL, GIT_BRANCH
from searx import get_setting 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) sys.path.insert(0, repo_root)
with open(repo_root + sep + brand_env, 'w', encoding='utf-8') as f: with open(repo_root + sep + brand_env, 'w', encoding='utf-8') as f:

View file

@ -53,7 +53,7 @@ source_dot_config() {
export eval_SEARX_SRC='true' export eval_SEARX_SRC='true'
SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
SEARX_PYENV=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_PYENV) 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 if [ ! -r "${SEARX_SRC}" ]; then
info_msg "not yet cloned: ${SEARX_SRC}" info_msg "not yet cloned: ${SEARX_SRC}"
orig_source_dot_config orig_source_dot_config
@ -115,7 +115,7 @@ init_SEARX_SRC_INIT_FILES(){
install_log_searx_instance() { 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 " 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 " SSEARX_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 " SEARX_URL : ${_BBlue}${SEARX_URL:-none}${_creset}"
@ -163,7 +163,7 @@ install_searx_get_state(){
echo "missing-searx-pyenv" echo "missing-searx-pyenv"
return return
fi fi
if ! [ -r "${SEARX_SETTINGS_PATH}" ]; then if ! [ -r "${SEARXNG_SETTINGS_PATH}" ]; then
echo "missing-settings" echo "missing-settings"
return return
fi fi

View file

@ -111,7 +111,7 @@ info_searx() {
cat <<EOF cat <<EOF
To activate result and image proxy in SearXNG read: To activate result and image proxy in SearXNG read:
https://searxng.github.io/searxng/admin/morty.html https://searxng.github.io/searxng/admin/morty.html
Check settings in file ${SEARX_SETTINGS_PATH} ... Check settings in file ${SEARXNG_SETTINGS_PATH} ...
result_proxy: result_proxy:
url : ${PUBLIC_URL_MORTY} url : ${PUBLIC_URL_MORTY}
server: server:

View file

@ -28,7 +28,7 @@ SERVICE_GROUP="${SERVICE_USER}"
GIT_BRANCH="${GIT_BRANCH:-master}" GIT_BRANCH="${GIT_BRANCH:-master}"
SEARX_PYENV="${SERVICE_HOME}/searx-pyenv" SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
SEARX_SRC="${SERVICE_HOME}/searx-src" SEARX_SRC="${SERVICE_HOME}/searx-src"
SEARX_SETTINGS_PATH="/etc/searx/settings.yml" SEARXNG_SETTINGS_PATH="/etc/searx/settings.yml"
SEARX_UWSGI_APP="searx.ini" SEARX_UWSGI_APP="searx.ini"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket" SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket"
@ -130,7 +130,7 @@ CONFIG_FILES=(
# shellcheck disable=SC2034 # shellcheck disable=SC2034
CONFIG_BACKUP_ENCRYPTED=( CONFIG_BACKUP_ENCRYPTED=(
"${SEARX_SETTINGS_PATH}" "${SEARXNG_SETTINGS_PATH}"
) )
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -160,7 +160,7 @@ install / remove
:init-src: copy files (SEARX_SRC_INIT_FILES) to ${SEARX_SRC} :init-src: copy files (SEARX_SRC_INIT_FILES) to ${SEARX_SRC}
:pyenv: create/remove virtualenv (python) in $SEARX_PYENV :pyenv: create/remove virtualenv (python) in $SEARX_PYENV
:uwsgi: install searx uWSGI application :uwsgi: install searx uWSGI application
:settings: reinstall settings from ${SEARX_SETTINGS_PATH} :settings: reinstall settings from ${SEARXNG_SETTINGS_PATH}
:packages: install needed packages from OS package manager :packages: install needed packages from OS package manager
:buildhost: install packages from OS package manager needed by buildhosts :buildhost: install packages from OS package manager needed by buildhosts
update searx update searx
@ -613,16 +613,16 @@ install_DOT_CONFIG(){
} }
install_settings() { install_settings() {
rst_title "${SEARX_SETTINGS_PATH}" section rst_title "${SEARXNG_SETTINGS_PATH}" section
if ! clone_is_available; then if ! clone_is_available; then
err_msg "you have to install SearXNG first" err_msg "you have to install SearXNG first"
exit 42 exit 42
fi fi
mkdir -p "$(dirname "${SEARX_SETTINGS_PATH}")" mkdir -p "$(dirname "${SEARXNG_SETTINGS_PATH}")"
install_template --no-eval \ install_template --no-eval \
"${SEARX_SETTINGS_PATH}" \ "${SEARXNG_SETTINGS_PATH}" \
"${SERVICE_USER}" "${SERVICE_GROUP}" "${SERVICE_USER}" "${SERVICE_GROUP}"
configure_searx configure_searx
} }
@ -630,8 +630,8 @@ install_settings() {
remove_settings() { remove_settings() {
rst_title "remove SearXNG settings" section rst_title "remove SearXNG settings" section
echo echo
info_msg "delete ${SEARX_SETTINGS_PATH}" info_msg "delete ${SEARXNG_SETTINGS_PATH}"
rm -f "${SEARX_SETTINGS_PATH}" rm -f "${SEARXNG_SETTINGS_PATH}"
} }
remove_searx() { remove_searx() {
@ -692,11 +692,11 @@ EOF
configure_searx() { configure_searx() {
rst_title "Configure SearXNG" section rst_title "Configure SearXNG" section
rst_para "Setup SearXNG config located at $SEARX_SETTINGS_PATH" rst_para "Setup SearXNG config located at $SEARXNG_SETTINGS_PATH"
echo echo
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix" tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC} 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 EOF
} }
@ -711,15 +711,15 @@ test_local_searx() {
return return
fi fi
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 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix" tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
export SEARX_SETTINGS_PATH="${SEARX_SETTINGS_PATH}" export SEARXNG_SETTINGS_PATH="${SEARXNG_SETTINGS_PATH}"
cd ${SEARX_SRC} cd ${SEARX_SRC}
timeout 10 python searx/webapp.py & timeout 10 python searx/webapp.py &
sleep 3 sleep 3
curl --location --verbose --head --insecure $SEARX_INTERNAL_HTTP curl --location --verbose --head --insecure $SEARX_INTERNAL_HTTP
EOF 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() { install_searx_uwsgi() {
@ -753,7 +753,7 @@ enable_image_proxy() {
info_msg "try to enable image_proxy ..." info_msg "try to enable image_proxy ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix" tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC} 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 EOF
uWSGI_restart "$SEARX_UWSGI_APP" uWSGI_restart "$SEARX_UWSGI_APP"
} }
@ -762,7 +762,7 @@ disable_image_proxy() {
info_msg "try to enable image_proxy ..." info_msg "try to enable image_proxy ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix" tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC} 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 EOF
uWSGI_restart "$SEARX_UWSGI_APP" uWSGI_restart "$SEARX_UWSGI_APP"
} }
@ -772,7 +772,7 @@ enable_debug() {
info_msg "try to enable debug mode ..." info_msg "try to enable debug mode ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix" tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC} 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 EOF
uWSGI_restart "$SEARX_UWSGI_APP" uWSGI_restart "$SEARX_UWSGI_APP"
} }
@ -781,7 +781,7 @@ disable_debug() {
info_msg "try to disable debug mode ..." info_msg "try to disable debug mode ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix" tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC} 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 EOF
uWSGI_restart "$SEARX_UWSGI_APP" uWSGI_restart "$SEARX_UWSGI_APP"
} }
@ -791,8 +791,8 @@ set_result_proxy() {
# usage: set_result_proxy <URL> [<key>] # usage: set_result_proxy <URL> [<key>]
info_msg "try to set result proxy: '$1' ($2)" info_msg "try to set result proxy: '$1' ($2)"
cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak" cp "${SEARXNG_SETTINGS_PATH}" "${SEARXNG_SETTINGS_PATH}.bak"
_set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}" _set_result_proxy "$1" "$2" > "${SEARXNG_SETTINGS_PATH}"
} }
_set_result_proxy() { _set_result_proxy() {
@ -829,7 +829,7 @@ _set_result_proxy() {
fi fi
fi fi
echo "$line" echo "$line"
done < "${SEARX_SETTINGS_PATH}.bak" done < "${SEARXNG_SETTINGS_PATH}.bak"
} }
function has_substring() { function has_substring() {

View file

@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8
chdir = ${SEARX_SRC}/searx chdir = ${SEARX_SRC}/searx
# searx configuration (settings.yml) # searx configuration (settings.yml)
env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
# disable logging for privacy # disable logging for privacy
logger = systemd logger = systemd

View file

@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8
chdir = ${SEARX_SRC}/searx chdir = ${SEARX_SRC}/searx
# searx configuration (settings.yml) # searx configuration (settings.yml)
env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
# disable logging for privacy # disable logging for privacy
logger = systemd logger = systemd

View file

@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8
chdir = ${SEARX_SRC}/searx chdir = ${SEARX_SRC}/searx
# searx configuration (settings.yml) # searx configuration (settings.yml)
env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
# disable logging for privacy # disable logging for privacy
disable-logging = true disable-logging = true

View file

@ -18,7 +18,7 @@ env = LC_ALL=C.UTF-8
chdir = ${SEARX_SRC}/searx chdir = ${SEARX_SRC}/searx
# searx configuration (settings.yml) # searx configuration (settings.yml)
env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH} env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
# disable logging for privacy # disable logging for privacy
disable-logging = true disable-logging = true