coderabbit suggestions

This commit is contained in:
Adam Outler
2026-03-04 01:33:43 +00:00
parent f1496b483b
commit 5c0f29b97c
5 changed files with 23 additions and 10 deletions
@@ -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