mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
SearXNG: SEARXNG_SETTINGS_PATH
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -111,7 +111,7 @@ info_searx() {
|
||||
cat <<EOF
|
||||
To activate result and image proxy in SearXNG read:
|
||||
https://searxng.github.io/searxng/admin/morty.html
|
||||
Check settings in file ${SEARX_SETTINGS_PATH} ...
|
||||
Check settings in file ${SEARXNG_SETTINGS_PATH} ...
|
||||
result_proxy:
|
||||
url : ${PUBLIC_URL_MORTY}
|
||||
server:
|
||||
|
||||
@@ -28,7 +28,7 @@ SERVICE_GROUP="${SERVICE_USER}"
|
||||
GIT_BRANCH="${GIT_BRANCH:-master}"
|
||||
SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
|
||||
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"
|
||||
# shellcheck disable=SC2034
|
||||
SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket"
|
||||
@@ -130,7 +130,7 @@ CONFIG_FILES=(
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
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}
|
||||
:pyenv: create/remove virtualenv (python) in $SEARX_PYENV
|
||||
: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
|
||||
:buildhost: install packages from OS package manager needed by buildhosts
|
||||
update searx
|
||||
@@ -613,16 +613,16 @@ install_DOT_CONFIG(){
|
||||
}
|
||||
|
||||
install_settings() {
|
||||
rst_title "${SEARX_SETTINGS_PATH}" section
|
||||
rst_title "${SEARXNG_SETTINGS_PATH}" section
|
||||
|
||||
if ! clone_is_available; then
|
||||
err_msg "you have to install SearXNG first"
|
||||
exit 42
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "${SEARX_SETTINGS_PATH}")"
|
||||
mkdir -p "$(dirname "${SEARXNG_SETTINGS_PATH}")"
|
||||
install_template --no-eval \
|
||||
"${SEARX_SETTINGS_PATH}" \
|
||||
"${SEARXNG_SETTINGS_PATH}" \
|
||||
"${SERVICE_USER}" "${SERVICE_GROUP}"
|
||||
configure_searx
|
||||
}
|
||||
@@ -630,8 +630,8 @@ install_settings() {
|
||||
remove_settings() {
|
||||
rst_title "remove SearXNG settings" section
|
||||
echo
|
||||
info_msg "delete ${SEARX_SETTINGS_PATH}"
|
||||
rm -f "${SEARX_SETTINGS_PATH}"
|
||||
info_msg "delete ${SEARXNG_SETTINGS_PATH}"
|
||||
rm -f "${SEARXNG_SETTINGS_PATH}"
|
||||
}
|
||||
|
||||
remove_searx() {
|
||||
@@ -692,11 +692,11 @@ EOF
|
||||
|
||||
configure_searx() {
|
||||
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
|
||||
tee_stderr 0.1 <<EOF | sudo -H -i 2>&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 <<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}
|
||||
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 <<EOF | sudo -H -i 2>&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 <<EOF | sudo -H -i 2>&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 <<EOF | sudo -H -i 2>&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 <<EOF | sudo -H -i 2>&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 <URL> [<key>]
|
||||
|
||||
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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user