mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
coderabbit suggestions
This commit is contained in:
@@ -12,10 +12,13 @@ fi
|
||||
if [ -n "${LOADED_PLUGINS:-}" ]; then
|
||||
echo "[ENV] Applying LOADED_PLUGINS override"
|
||||
value=$(printf '%s' "$LOADED_PLUGINS" | tr -d '\n\r')
|
||||
escaped=$(printf '%s\n' "$value" | sed 's/[\/&]/\\&/g')
|
||||
# declare delimiter for sed and escape it along with / and &
|
||||
delim='|'
|
||||
escaped=$(printf '%s\n' "$value" | sed "s/[\/${delim}&]/\\&/g")
|
||||
|
||||
if grep -q '^LOADED_PLUGINS=' "${NETALERTX_CONFIG}/app.conf"; then
|
||||
sed -i "s|^LOADED_PLUGINS=.*|LOADED_PLUGINS=${escaped}|" "${NETALERTX_CONFIG}/app.conf"
|
||||
# use same delimiter when substituting
|
||||
sed -i "s${delim}^LOADED_PLUGINS=.*${delim}LOADED_PLUGINS=${escaped}${delim}" "${NETALERTX_CONFIG}/app.conf"
|
||||
else
|
||||
echo "LOADED_PLUGINS=${value}" >> "${NETALERTX_CONFIG}/app.conf"
|
||||
fi
|
||||
|
||||
@@ -86,10 +86,11 @@ for script in "${ENTRYPOINT_CHECKS}"/*; do
|
||||
fi
|
||||
script_name=$(basename "$script" | sed 's/^[0-9]*-//;s/\.(sh|py)$//;s/-/ /g')
|
||||
echo "--> ${script_name} "
|
||||
if [ -n "${SKIP_STARTUP_CHECKS:-}" ] && echo "${SKIP_STARTUP_CHECKS}" | grep -Fq "${script_name}"; then
|
||||
printf "%sskip%s\n" "${GREY}" "${RESET}"
|
||||
continue
|
||||
fi
|
||||
if [ -n "${SKIP_STARTUP_CHECKS:-}" ] &&
|
||||
printf '%s' "${SKIP_STARTUP_CHECKS}" | grep -wFq -- "${script_name}"; then
|
||||
printf "%sskip%s\n" "${GREY}" "${RESET}"
|
||||
continue
|
||||
fi
|
||||
|
||||
"$script"
|
||||
NETALERTX_DOCKER_ERROR_CHECK=$?
|
||||
|
||||
@@ -48,8 +48,9 @@ else
|
||||
log_error "python /app/server is not running"
|
||||
fi
|
||||
|
||||
# 5. Check port 20211 is open and contains "netalertx"
|
||||
[ "${LISTEN_ADDR}" == "0.0.0.0" ] && CHECK_ADDR="127.0.0.1" || CHECK_ADDR="${LISTEN_ADDR}";
|
||||
# 5. Check port 20211 is open
|
||||
CHECK_ADDR="${LISTEN_ADDR:-127.0.0.1}"
|
||||
[ "${CHECK_ADDR}" == "0.0.0.0" ] && CHECK_ADDR="127.0.0.1"
|
||||
if timeout 10 bash -c "</dev/tcp/${CHECK_ADDR}/${PORT:-20211}" 2>/dev/null; then
|
||||
log_success "Port ${PORT:-20211} is responding"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user