e0956c6043
- Remove all personal data from source code (HA IP, JWT tokens) - Move secrets to .env configuration (gitignored) - Create .env.example template for new installations - Add centralized env() helper, eliminate code duplication (~120 lines removed) - Add input validation on inventory operations (quantity bounds, location whitelist) - Remove sensitive credential exposure in API responses - Remove database and runtime files from Git tracking - Disable database push-to-GitHub backup (local-only backup now) - Update .gitignore for distribution - Add comprehensive README with installation guide - Add CHANGELOG.md for version tracking - Add MIT LICENSE - Add author/license headers to all source files - TTS defaults now empty (configured per-installation via .env)
24 lines
633 B
Bash
Executable File
24 lines
633 B
Bash
Executable File
#!/bin/bash
|
|
# Daily backup of Dispensa database (local only)
|
|
# The database is NOT pushed to remote repositories.
|
|
# Runs via cron: creates a local timestamped backup copy
|
|
#
|
|
# Example crontab entry:
|
|
# 0 3 * * * /var/www/html/dispensa/backup.sh
|
|
|
|
INSTALL_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
BACKUP_DIR="${INSTALL_DIR}/data/backups"
|
|
|
|
mkdir -p "$BACKUP_DIR"
|
|
|
|
DB_FILE="${INSTALL_DIR}/data/dispensa.db"
|
|
if [ ! -f "$DB_FILE" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
DATE=$(date '+%Y-%m-%d_%H%M')
|
|
cp "$DB_FILE" "${BACKUP_DIR}/dispensa_${DATE}.db"
|
|
|
|
# Keep only the last 7 backups
|
|
ls -t "${BACKUP_DIR}"/dispensa_*.db 2>/dev/null | tail -n +8 | xargs -r rm --
|