Update backup system and settings UI

- Improved backup path handling for Docker environments
- Changed default backup type to data-only for scheduled backups
- Updated settings.html with enhanced backup management UI
- Replaced 'Drop Table' with 'Truncate Table' functionality
  - Clear data while preserving structure and triggers
  - Changed from danger zone styling (red) to caution styling (orange)
  - Added clear confirmation dialog with table name verification
- Added upload backup file functionality
- Improved backup schedule management with edit/toggle/delete
- Updated styling and dark mode support
- Removed old backup metadata files
This commit is contained in:
Quality App Developer
2026-01-09 10:51:43 +02:00
parent 77463c1c47
commit 8faf5cd9fe
5 changed files with 363 additions and 2017 deletions

View File

@@ -78,14 +78,21 @@ class DatabaseBackupManager:
return None
def _get_backup_path(self):
"""Get backup path from environment or use default"""
# Check environment variable (set in docker-compose)
backup_path = os.environ.get('BACKUP_PATH', '/srv/quality_app/backups')
"""Get backup path - use container path when in Docker"""
# When running in Docker container, use the mounted container path
# The volume is always mounted at /srv/quality_app/backups in the container
# regardless of the host path specified in BACKUP_PATH env var
if os.path.exists('/.dockerenv') or os.environ.get('DOCKER_CONTAINER'):
# Running in Docker - use container path
backup_path = '/srv/quality_app/backups'
else:
# Running on host - use environment variable or default
backup_path = os.environ.get('BACKUP_PATH', '/srv/quality_app/backups')
# Check if custom path is set in config
# Check if custom path is set in config (host deployments)
try:
settings_file = os.path.join(current_app.instance_path, 'external_server.conf')
if os.path.exists(settings_file):
if os.path.exists(settings_file) and not (os.path.exists('/.dockerenv') or os.environ.get('DOCKER_CONTAINER')):
with open(settings_file, 'r') as f:
for line in f:
if line.startswith('backup_path='):
@@ -672,7 +679,7 @@ class DatabaseBackupManager:
'enabled': False,
'time': '02:00', # 2 AM
'frequency': 'daily', # daily, weekly, monthly
'backup_type': 'full', # full or data-only
'backup_type': 'data-only', # full or data-only
'retention_days': 30 # Keep backups for 30 days
}