BE: ensure /db - better error #1327
Some checks failed
Code checks / check-url-paths (push) Has been cancelled
Code checks / lint (push) Has been cancelled
Code checks / docker-tests (push) Has been cancelled
docker / docker_dev (push) Has been cancelled
Deploy MkDocs / deploy (push) Has been cancelled

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2025-12-04 10:22:34 +11:00
parent ef2e7886c4
commit 3d17dc47b5

View File

@@ -11,10 +11,21 @@ RESET=$(printf '\033[0m')
# Ensure DB folder exists # Ensure DB folder exists
if [ ! -d "${NETALERTX_DB}" ]; then if [ ! -d "${NETALERTX_DB}" ]; then
mkdir -p "${NETALERTX_DB}" || { if ! mkdir -p "${NETALERTX_DB}"; then
>&2 echo "ERROR: Failed to create DB directory at ${NETALERTX_DB}" >&2 printf "%s" "${RED}"
>&2 cat <<EOF
══════════════════════════════════════════════════════════════════════════════
❌ Error creating DB folder in: ${NETALERTX_DB}
A database directory is required for proper operation, however there appear to be
insufficient permissions on this mount or it is otherwise inaccessible.
More info: https://github.com/jokob-sk/NetAlertX/blob/main/docs/FILE_PERMISSIONS.md
══════════════════════════════════════════════════════════════════════════════
EOF
>&2 printf "%s" "${RESET}"
exit 1 exit 1
} fi
chmod 700 "${NETALERTX_DB}" 2>/dev/null || true chmod 700 "${NETALERTX_DB}" 2>/dev/null || true
fi fi